]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/IScsiDxe/IScsiDriver.h
Enhance TargetName check when save iSCSI configuration.
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiDriver.h
CommitLineData
4c5a5e0c 1/** @file\r
2 The header file of IScsiDriver.c.\r
3\r
6879581d 4Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>\r
4c5a5e0c 5This 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
12\r
13**/\r
14\r
15#ifndef _ISCSI_DRIVER_H_\r
16#define _ISCSI_DRIVER_H_\r
17\r
18#define ISCSI_V4_PRIVATE_GUID \\r
19 { \\r
20 0xfa3cde4c, 0x87c2, 0x427d, { 0xae, 0xde, 0x7d, 0xd0, 0x96, 0xc8, 0x8c, 0x58 } \\r
21 }\r
22\r
23#define ISCSI_V6_PRIVATE_GUID \\r
24 { \\r
25 0x28be27e5, 0x66cc, 0x4a31, { 0xa3, 0x15, 0xdb, 0x14, 0xc3, 0x74, 0x4d, 0x85 } \\r
26 }\r
27\r
28#define ISCSI_INITIATOR_NAME_VAR_NAME L"I_NAME"\r
29\r
30#define IP_MODE_AUTOCONFIG_IP4 3\r
31#define IP_MODE_AUTOCONFIG_IP6 4\r
32#define IP_MODE_AUTOCONFIG_SUCCESS 5\r
33\r
34extern EFI_COMPONENT_NAME2_PROTOCOL gIScsiComponentName2;\r
35extern EFI_COMPONENT_NAME_PROTOCOL gIScsiComponentName;\r
216f7970 36extern EFI_UNICODE_STRING_TABLE *gIScsiControllerNameTable;\r
4c5a5e0c 37extern EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName;\r
38extern EFI_AUTHENTICATION_INFO_PROTOCOL gIScsiAuthenticationInfo;\r
39extern EFI_EXT_SCSI_PASS_THRU_PROTOCOL gIScsiExtScsiPassThruProtocolTemplate;\r
216f7970 40extern EFI_GUID gIScsiV4PrivateGuid;\r
41extern EFI_GUID gIScsiV6PrivateGuid;\r
4c5a5e0c 42\r
43typedef struct {\r
44 CHAR16 PortString[ISCSI_NAME_IFR_MAX_SIZE];\r
45 LIST_ENTRY NicInfoList;\r
46 UINT8 NicCount;\r
47 UINT8 CurrentNic;\r
48 UINT8 MaxNic;\r
49 BOOLEAN Ipv6Flag;\r
50 BOOLEAN OneSessionEstablished;\r
51 BOOLEAN EnableMpio;\r
52 UINT8 MpioCount; // The number of attempts in MPIO.\r
53 UINT8 Krb5MpioCount; // The number of attempts login with KRB5 in MPIO.\r
54 UINT8 SinglePathCount; // The number of single path attempts.\r
55 UINT8 ValidSinglePathCount; // The number of valid single path attempts.\r
56 UINT8 BootSelectedIndex;\r
57 UINT8 AttemptCount;\r
58 LIST_ENTRY AttemptConfigs; // User configured Attempt list.\r
59 CHAR8 InitiatorName[ISCSI_NAME_MAX_SIZE];\r
60 UINTN InitiatorNameLength;\r
c0d494b5 61 VOID *NewAttempt; // Attempt is created but not saved.\r
4c5a5e0c 62} ISCSI_PRIVATE_DATA;\r
63\r
64extern ISCSI_PRIVATE_DATA *mPrivate;\r
65\r
66typedef struct {\r
67 LIST_ENTRY Link;\r
68 UINT32 HwAddressSize;\r
69 EFI_MAC_ADDRESS PermanentAddress;\r
70 UINT8 NicIndex;\r
71 UINT16 VlanId;\r
72 UINTN BusNumber;\r
73 UINTN DeviceNumber;\r
74 UINTN FunctionNumber;\r
75} ISCSI_NIC_INFO;\r
76\r
77typedef struct _ISCSI_PRIVATE_PROTOCOL {\r
78 UINT32 Reserved;\r
79} ISCSI_PRIVATE_PROTOCOL;\r
80\r
81//\r
82// EFI Driver Binding Protocol for iSCSI driver.\r
83//\r
84\r
85/**\r
86 Tests to see if this driver supports a given controller. If a child device is provided, \r
87 it tests to see if this driver supports creating a handle for the specified child device.\r
88\r
89 This function checks to see if the driver specified by This supports the device specified by \r
90 ControllerHandle. Drivers typically use the device path attached to \r
91 ControllerHandle and/or the services from the bus I/O abstraction attached to \r
92 ControllerHandle to determine if the driver supports ControllerHandle. This function \r
93 may be called many times during platform initialization. In order to reduce boot times, the tests \r
94 performed by this function must be very small and take as little time as possible to execute. This \r
95 function must not change the state of any hardware devices, and this function must be aware that the \r
96 device specified by ControllerHandle may already be managed by the same driver or a \r
97 different driver. This function must match its calls to AllocatePages() with FreePages(), \r
98 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). \r
99 Since ControllerHandle may have been previously started by the same driver, if a protocol is \r
100 already in the opened state, then it must not be closed with CloseProtocol(). This is required \r
101 to guarantee the state of ControllerHandle is not modified by this function.\r
102\r
103 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
104 @param[in] ControllerHandle The handle of the controller to test. This handle \r
105 must support a protocol interface that supplies \r
106 an I/O abstraction to the driver.\r
107 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This \r
108 parameter is ignored by device drivers, and is optional for bus \r
109 drivers. For bus drivers, if this parameter is not NULL, then \r
110 the bus driver must determine if the bus controller specified \r
111 by ControllerHandle and the child controller specified \r
112 by RemainingDevicePath are both supported by this \r
113 bus driver.\r
114\r
115 @retval EFI_SUCCESS The device specified by ControllerHandle and\r
116 RemainingDevicePath is supported by the driver specified by This.\r
117 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r
118 RemainingDevicePath is already managed by the driver\r
119 specified by This.\r
120 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r
121 RemainingDevicePath is already managed by a different\r
122 driver or an application that requires exclusive access.\r
123 Currently not implemented.\r
124 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r
125 RemainingDevicePath is not supported by the driver specified by This.\r
126**/\r
127EFI_STATUS\r
128EFIAPI\r
6879581d 129IScsiIp4DriverBindingSupported (\r
4c5a5e0c 130 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
131 IN EFI_HANDLE ControllerHandle,\r
132 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
133 );\r
134\r
135/**\r
136 Starts a device controller or a bus controller.\r
137\r
138 The Start() function is designed to be invoked from the EFI boot service ConnectController().\r
139 As a result, much of the error checking on the parameters to Start() has been moved into this \r
140 common boot service. It is legal to call Start() from other locations, \r
141 but the following calling restrictions must be followed or the system behavior will not be deterministic.\r
142 1. ControllerHandle must be a valid EFI_HANDLE.\r
143 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r
144 EFI_DEVICE_PATH_PROTOCOL.\r
145 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r
146 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. \r
147\r
148 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
149 @param[in] ControllerHandle The handle of the controller to start. This handle \r
150 must support a protocol interface that supplies \r
151 an I/O abstraction to the driver.\r
152 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This \r
153 parameter is ignored by device drivers, and is optional for bus \r
154 drivers. For a bus driver, if this parameter is NULL, then handles \r
155 for all the children of Controller are created by this driver. \r
156 If this parameter is not NULL and the first Device Path Node is \r
157 not the End of Device Path Node, then only the handle for the \r
158 child device specified by the first Device Path Node of \r
159 RemainingDevicePath is created by this driver.\r
160 If the first Device Path Node of RemainingDevicePath is \r
161 the End of Device Path Node, no child handle is created by this\r
162 driver.\r
163\r
164 @retval EFI_SUCCESS The device was started.\r
165 @retval EFI_DEVICE_ERROR The device could not be started due to a device error. Currently not implemented.\r
166 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
167 @retval Others The driver failed to start the device.\r
168\r
169**/\r
170EFI_STATUS\r
171EFIAPI\r
6879581d 172IScsiIp4DriverBindingStart (\r
4c5a5e0c 173 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
174 IN EFI_HANDLE ControllerHandle,\r
175 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
176 );\r
177\r
178/**\r
179 Stops a device controller or a bus controller.\r
180 \r
181 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). \r
182 As a result, much of the error checking on the parameters to Stop() has been moved \r
183 into this common boot service. It is legal to call Stop() from other locations, \r
184 but the following calling restrictions must be followed or the system behavior will not be deterministic.\r
185 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r
186 same driver's Start() function.\r
187 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r
188 EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
189 Start() function, and the Start() function must have called OpenProtocol() on\r
190 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
191 \r
192 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
193 @param[in] ControllerHandle A handle to the device being stopped. The handle must \r
194 support a bus specific I/O protocol for the driver \r
195 to use to stop the device.\r
196 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
197 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL \r
198 if NumberOfChildren is 0.\r
199\r
200 @retval EFI_SUCCESS The device was stopped.\r
201 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
202\r
203**/\r
204EFI_STATUS\r
205EFIAPI\r
6879581d 206IScsiIp4DriverBindingStop (\r
207 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
208 IN EFI_HANDLE ControllerHandle,\r
209 IN UINTN NumberOfChildren,\r
210 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
211 );\r
212\r
213/**\r
214 Tests to see if this driver supports a given controller. If a child device is provided, \r
215 it tests to see if this driver supports creating a handle for the specified child device.\r
216\r
217 This function checks to see if the driver specified by This supports the device specified by \r
218 ControllerHandle. Drivers typically use the device path attached to \r
219 ControllerHandle and/or the services from the bus I/O abstraction attached to \r
220 ControllerHandle to determine if the driver supports ControllerHandle. This function \r
221 may be called many times during platform initialization. In order to reduce boot times, the tests \r
222 performed by this function must be very small and take as little time as possible to execute. This \r
223 function must not change the state of any hardware devices, and this function must be aware that the \r
224 device specified by ControllerHandle may already be managed by the same driver or a \r
225 different driver. This function must match its calls to AllocatePages() with FreePages(), \r
226 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). \r
227 Since ControllerHandle may have been previously started by the same driver, if a protocol is \r
228 already in the opened state, then it must not be closed with CloseProtocol(). This is required \r
229 to guarantee the state of ControllerHandle is not modified by this function.\r
230\r
231 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
232 @param[in] ControllerHandle The handle of the controller to test. This handle \r
233 must support a protocol interface that supplies \r
234 an I/O abstraction to the driver.\r
235 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This \r
236 parameter is ignored by device drivers, and is optional for bus \r
237 drivers. For bus drivers, if this parameter is not NULL, then \r
238 the bus driver must determine if the bus controller specified \r
239 by ControllerHandle and the child controller specified \r
240 by RemainingDevicePath are both supported by this \r
241 bus driver.\r
242\r
243 @retval EFI_SUCCESS The device specified by ControllerHandle and\r
244 RemainingDevicePath is supported by the driver specified by This.\r
245 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r
246 RemainingDevicePath is already managed by the driver\r
247 specified by This.\r
248 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r
249 RemainingDevicePath is already managed by a different\r
250 driver or an application that requires exclusive access.\r
251 Currently not implemented.\r
252 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r
253 RemainingDevicePath is not supported by the driver specified by This.\r
254**/\r
255EFI_STATUS\r
256EFIAPI\r
257IScsiIp6DriverBindingSupported (\r
258 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
259 IN EFI_HANDLE ControllerHandle,\r
260 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
261 );\r
262\r
263/**\r
264 Starts a device controller or a bus controller.\r
265\r
266 The Start() function is designed to be invoked from the EFI boot service ConnectController().\r
267 As a result, much of the error checking on the parameters to Start() has been moved into this \r
268 common boot service. It is legal to call Start() from other locations, \r
269 but the following calling restrictions must be followed or the system behavior will not be deterministic.\r
270 1. ControllerHandle must be a valid EFI_HANDLE.\r
271 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r
272 EFI_DEVICE_PATH_PROTOCOL.\r
273 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r
274 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. \r
275\r
276 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
277 @param[in] ControllerHandle The handle of the controller to start. This handle \r
278 must support a protocol interface that supplies \r
279 an I/O abstraction to the driver.\r
280 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This \r
281 parameter is ignored by device drivers, and is optional for bus \r
282 drivers. For a bus driver, if this parameter is NULL, then handles \r
283 for all the children of Controller are created by this driver. \r
284 If this parameter is not NULL and the first Device Path Node is \r
285 not the End of Device Path Node, then only the handle for the \r
286 child device specified by the first Device Path Node of \r
287 RemainingDevicePath is created by this driver.\r
288 If the first Device Path Node of RemainingDevicePath is \r
289 the End of Device Path Node, no child handle is created by this\r
290 driver.\r
291\r
292 @retval EFI_SUCCESS The device was started.\r
293 @retval EFI_DEVICE_ERROR The device could not be started due to a device error. Currently not implemented.\r
294 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
295 @retval Others The driver failed to start the device.\r
296\r
297**/\r
298EFI_STATUS\r
299EFIAPI\r
300IScsiIp6DriverBindingStart (\r
301 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
302 IN EFI_HANDLE ControllerHandle,\r
303 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
304 );\r
305\r
306/**\r
307 Stops a device controller or a bus controller.\r
308 \r
309 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). \r
310 As a result, much of the error checking on the parameters to Stop() has been moved \r
311 into this common boot service. It is legal to call Stop() from other locations, \r
312 but the following calling restrictions must be followed or the system behavior will not be deterministic.\r
313 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r
314 same driver's Start() function.\r
315 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r
316 EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
317 Start() function, and the Start() function must have called OpenProtocol() on\r
318 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
319 \r
320 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
321 @param[in] ControllerHandle A handle to the device being stopped. The handle must \r
322 support a bus specific I/O protocol for the driver \r
323 to use to stop the device.\r
324 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
325 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL \r
326 if NumberOfChildren is 0.\r
327\r
328 @retval EFI_SUCCESS The device was stopped.\r
329 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
330\r
331**/\r
332EFI_STATUS\r
333EFIAPI\r
334IScsiIp6DriverBindingStop (\r
4c5a5e0c 335 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
336 IN EFI_HANDLE ControllerHandle,\r
337 IN UINTN NumberOfChildren,\r
338 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
339 );\r
340\r
341//\r
342// EFI Component Name(2) Protocol for iSCSI driver.\r
343//\r
344\r
345/**\r
346 Retrieves a Unicode string that is the user readable name of the driver.\r
347\r
348 This function retrieves the user readable name of a driver in the form of a\r
349 Unicode string. If the driver specified by This has a user readable name in\r
350 the language specified by Language, then a pointer to the driver name is\r
351 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
352 by This does not support the language specified by Language,\r
353 then EFI_UNSUPPORTED is returned.\r
354\r
355 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
356 EFI_COMPONENT_NAME_PROTOCOL instance.\r
357\r
358 @param[in] Language A pointer to a Null-terminated ASCII string\r
359 array indicating the language. This is the\r
360 language of the driver name that the caller is\r
361 requesting, and it must match one of the\r
362 languages specified in SupportedLanguages. The\r
363 number of languages supported by a driver is up\r
364 to the driver writer. Language is specified\r
365 in RFC 4646 or ISO 639-2 language code format.\r
366\r
367 @param[out] DriverName A pointer to the Unicode string to return.\r
368 This Unicode string is the name of the\r
369 driver specified by This in the language\r
370 specified by Language.\r
371\r
372 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
373 This and the language specified by Language was\r
374 returned in DriverName.\r
375\r
376 @retval EFI_INVALID_PARAMETER Language is NULL.\r
377\r
378 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
379\r
380 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
381 the language specified by Language.\r
382\r
383**/\r
384EFI_STATUS\r
385EFIAPI\r
386IScsiComponentNameGetDriverName (\r
387 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
388 IN CHAR8 *Language,\r
389 OUT CHAR16 **DriverName\r
390 );\r
391\r
392/**\r
393 Retrieves a Unicode string that is the user readable name of the controller\r
394 that is being managed by a driver.\r
395\r
396 This function retrieves the user readable name of the controller specified by\r
397 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
398 driver specified by This has a user readable name in the language specified by\r
399 Language, then a pointer to the controller name is returned in ControllerName,\r
400 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
401 managing the controller specified by ControllerHandle and ChildHandle,\r
402 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
403 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
404\r
405 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
406 EFI_COMPONENT_NAME_PROTOCOL instance.\r
407\r
408 @param[in] ControllerHandle The handle of a controller that the driver\r
409 specified by This is managing. This handle\r
410 specifies the controller whose name is to be\r
411 returned.\r
412\r
413 @param[in] ChildHandle The handle of the child controller to retrieve\r
414 the name of. This is an optional parameter that\r
415 may be NULL. It will be NULL for device\r
416 drivers. It will also be NULL for a bus drivers\r
417 that wish to retrieve the name of the bus\r
418 controller. It will not be NULL for a bus\r
419 driver that wishes to retrieve the name of a\r
420 child controller.\r
421\r
422 @param[in] Language A pointer to a Null-terminated ASCII string\r
423 array indicating the language. This is the\r
424 language of the driver name that the caller is\r
425 requesting, and it must match one of the\r
426 languages specified in SupportedLanguages. The\r
427 number of languages supported by a driver is \r
428 determined by the driver writer. Language is \r
429 specified inRFC 4646 or ISO 639-2 language code \r
430 format.\r
431 \r
432 @param[out] ControllerName A pointer to the Unicode string to return.\r
433 This Unicode string is the name of the\r
434 controller specified by ControllerHandle and\r
435 ChildHandle in the language specified by\r
436 Language from the point of view of the driver\r
437 specified by This.\r
438\r
439 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
440 the language specified by Language for the\r
441 driver specified by This was returned in\r
442 DriverName.\r
443\r
444 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
445\r
446 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
447 EFI_HANDLE.\r
448\r
449 @retval EFI_INVALID_PARAMETER Language is NULL.\r
450\r
451 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
452\r
453 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
454 managing the controller specified by\r
455 ControllerHandle and ChildHandle.\r
456\r
457 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
458 the language specified by Language.\r
459\r
460**/\r
461EFI_STATUS\r
462EFIAPI\r
463IScsiComponentNameGetControllerName (\r
464 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
465 IN EFI_HANDLE ControllerHandle,\r
466 IN EFI_HANDLE ChildHandle OPTIONAL,\r
467 IN CHAR8 *Language,\r
468 OUT CHAR16 **ControllerName\r
469 );\r
470\r
471//\r
472// EFI iSCSI Initiator Name Protocol for iSCSI driver.\r
473//\r
474\r
475/**\r
476 Retrieves the current set value of iSCSI Initiator Name.\r
477\r
478 @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL\r
479 instance.\r
480 @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer /\r
481 Actual size of the variable data buffer.\r
482 @param[out] Buffer Pointer to the buffer for data to be read.\r
483\r
484 @retval EFI_SUCCESS Data was successfully retrieved into the provided\r
485 buffer and the BufferSize was sufficient to handle\r
486 the iSCSI initiator name.\r
487 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result. BufferSize\r
488 will be updated with the size required to complete\r
489 the request. Buffer will not be affected.\r
490 @retval EFI_INVALID_PARAMETER BufferSize is NULL. BufferSize and Buffer will not\r
491 be affected.\r
492 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be\r
493 affected.\r
494 @retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved\r
495 due to a hardware error.\r
496\r
497**/\r
498EFI_STATUS\r
499EFIAPI\r
500IScsiGetInitiatorName (\r
501 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,\r
502 IN OUT UINTN *BufferSize,\r
503 OUT VOID *Buffer\r
504 );\r
505\r
506/**\r
507 Sets the iSSI Initiator Name.\r
508\r
509 @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL\r
510 instance.\r
511 @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer.\r
512 @param[in] Buffer Pointer to the buffer for data to be written.\r
513\r
514 @retval EFI_SUCCESS Data was successfully stored by the protocol.\r
515 @retval EFI_UNSUPPORTED Platform policies do not allow for data to be\r
516 written.\r
517 @retval EFI_INVALID_PARAMETER BufferSize exceeds the maximum allowed limit.\r
518 BufferSize will be updated with the maximum size\r
519 required to complete the request.\r
520 @retval EFI_INVALID_PARAMETER Buffersize is NULL. BufferSize and Buffer will not\r
521 be affected.\r
522 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be\r
523 affected.\r
524 @retval EFI_DEVICE_ERROR The data could not be stored due to a hardware\r
525 error.\r
526 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data\r
527 @retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC\r
528 3720\r
529\r
530**/\r
531EFI_STATUS\r
532EFIAPI\r
533IScsiSetInitiatorName (\r
534 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,\r
535 IN OUT UINTN *BufferSize,\r
536 IN VOID *Buffer\r
537 );\r
538\r
539//\r
540// EFI_AUTHENTICATION_INFO_PROTOCOL for iSCSI driver.\r
541//\r
542\r
543/**\r
544 Retrieves the authentication information associated with a particular controller handle.\r
545\r
546 @param[in] This Pointer to the EFI_AUTHENTICATION_INFO_PROTOCOL.\r
547 @param[in] ControllerHandle Handle to the Controller.\r
548 @param[out] Buffer Pointer to the authentication information. This function is\r
549 responsible for allocating the buffer and it is the caller's\r
550 responsibility to free buffer when the caller is finished with buffer.\r
551\r
552 @retval EFI_DEVICE_ERROR The authentication information could not be\r
553 retrieved due to a hardware error.\r
554\r
555**/\r
556EFI_STATUS\r
557EFIAPI\r
558IScsiGetAuthenticationInfo (\r
559 IN EFI_AUTHENTICATION_INFO_PROTOCOL *This,\r
560 IN EFI_HANDLE ControllerHandle,\r
561 OUT VOID **Buffer\r
562 );\r
563\r
564/**\r
565 Set the authentication information for a given controller handle.\r
566\r
567 @param[in] This Pointer to the EFI_AUTHENTICATION_INFO_PROTOCOL.\r
568 @param[in] ControllerHandle Handle to the Controller.\r
569 @param[in] Buffer Pointer to the authentication information.\r
570\r
571 @retval EFI_UNSUPPORTED If the platform policies do not allow setting of\r
572 the authentication information.\r
573\r
574**/\r
575EFI_STATUS\r
576EFIAPI\r
577IScsiSetAuthenticationInfo (\r
578 IN EFI_AUTHENTICATION_INFO_PROTOCOL *This,\r
579 IN EFI_HANDLE ControllerHandle,\r
580 IN VOID *Buffer\r
581 );\r
582\r
583//\r
584// EFI_EXT_SCSI_PASS_THRU_PROTOCOL for iSCSI driver.\r
585//\r
586\r
587/**\r
588 Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel.\r
589 This function supports both blocking I/O and nonblocking I/O. The blocking I/O\r
590 functionality is required, and the nonblocking I/O functionality is optional. \r
591\r
592 @param[in] This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
593 @param[in] Target The Target is an array of size TARGET_MAX_BYTES and it\r
594 represents the id of the SCSI device to send the SCSI\r
595 Request Packet. Each transport driver may choose to\r
596 utilize a subset of this size to suit the needs\r
597 of transport target representation. For example, a \r
598 Fibre Channel driver may use only 8 bytes (WWN)\r
599 to represent an FC target.\r
600 @param[in] Lun The LUN of the SCSI device to send the SCSI Request Packet.\r
601 @param[in, out] Packet A pointer to the SCSI Request Packet to send to the\r
602 SCSI device specified by Target and Lun. \r
603 @param[in] Event If nonblocking I/O is not supported then Event is ignored,\r
604 and blocking I/O is performed. If Event is NULL, then\r
605 blocking I/O is performed. If Event is not NULL and non\r
606 blocking I/O is supported, then nonblocking I/O is performed,\r
607 and Event will be signaled when the SCSI Request Packet\r
608 completes.\r
609\r
610 @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For\r
611 bi-directional commands, InTransferLength bytes \r
612 were transferred from InDataBuffer.\r
613 For write and bi-directional commands, OutTransferLength\r
614 bytes were transferred by OutDataBuffer.\r
615 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was not executed.\r
616 The number of bytes that could be transferred is\r
617 returned in InTransferLength. For write and\r
618 bi-directional commands, OutTransferLength bytes\r
619 were transferred by OutDataBuffer.\r
620 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because\r
621 there are too many SCSI Request Packets already\r
622 queued. The caller may retry later.\r
623 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send\r
624 the SCSI Request Packet. \r
625 @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket\r
626 are invalid.\r
627 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
628 is not supported by the host adapter.\r
629 This includes the case of Bi-directional SCSI\r
630 commands not supported by the implementation.\r
631 The SCSI Request Packet was not sent,\r
632 so no additional status information is available.\r
633 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI\r
634 Request Packet to execute.\r
635\r
636**/\r
637EFI_STATUS\r
638EFIAPI\r
639IScsiExtScsiPassThruFunction (\r
640 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
641 IN UINT8 *Target,\r
642 IN UINT64 Lun,\r
643 IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r
644 IN EFI_EVENT Event OPTIONAL\r
645 );\r
646\r
647/**\r
648 Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on\r
649 a SCSI channel. These can either be the list SCSI devices that are actually\r
650 present on the SCSI channel, or the list of legal Target Ids and LUNs for the\r
651 SCSI channel. Regardless, the caller of this function must probe the Target ID \r
652 and LUN returned to see if a SCSI device is actually present at that location \r
653 on the SCSI channel. \r
654\r
655 @param[in] This The EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
656 @param[in, out] Target On input, a pointer to the Target ID of a SCSI\r
657 device present on the SCSI channel. On output, a\r
658 pointer to the Target ID of the next SCSI device\r
659 present on a SCSI channel. An input value of\r
660 0xFFFFFFFF retrieves the Target ID of the first\r
661 SCSI device present on a SCSI channel.\r
662 @param[in, out] Lun On input, a pointer to the LUN of a SCSI device\r
663 present on the SCSI channel. On output, a pointer\r
664 to the LUN of the next SCSI device present on a\r
665 SCSI channel.\r
666\r
667 @retval EFI_SUCCESS The Target ID and Lun of the next SCSI device on\r
668 the SCSI channel was returned in Target and Lun.\r
669 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI\r
670 channel.\r
671 @retval EFI_INVALID_PARAMETER Target is not 0xFFFFFFFF,and Target and Lun were\r
672 not returned on a previous call to\r
673 GetNextDevice().\r
674\r
675**/\r
676EFI_STATUS\r
677EFIAPI\r
678IScsiExtScsiPassThruGetNextTargetLun (\r
679 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
680 IN OUT UINT8 **Target,\r
681 IN OUT UINT64 *Lun\r
682 );\r
683\r
684/**\r
685 Allocate and build a device path node for a SCSI device on a SCSI channel.\r
686\r
687 @param[in] This Protocol instance pointer.\r
688 @param[in] Target The Target ID of the SCSI device for which a\r
689 device path node is to be allocated and built.\r
690 @param[in] Lun The LUN of the SCSI device for which a device\r
691 path node is to be allocated and built.\r
692 @param[in, out] DevicePath A pointer to a single device path node that\r
693 describes the SCSI device specified by Target and\r
694 Lun. This function is responsible for allocating\r
695 the buffer DevicePath with the boot service\r
696 AllocatePool(). It is the caller's\r
697 responsibility to free DevicePath when the caller\r
698 is finished with DevicePath.\r
699\r
700 @retval EFI_SUCCESS The device path node that describes the SCSI\r
701 device specified by Target and Lun was allocated\r
702 and returned in DevicePath.\r
703 @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does\r
704 not exist on the SCSI channel.\r
705 @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
706 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate\r
707 DevicePath.\r
708\r
709**/\r
710EFI_STATUS\r
711EFIAPI\r
712IScsiExtScsiPassThruBuildDevicePath (\r
713 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
714 IN UINT8 *Target,\r
715 IN UINT64 Lun,\r
716 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
717 );\r
718\r
719/**\r
720 Translate a device path node to a Target ID and LUN.\r
721\r
722 @param[in] This Protocol instance pointer.\r
723 @param[in] DevicePath A pointer to the device path node that describes\r
724 a SCSI device on the SCSI channel.\r
725 @param[out] Target A pointer to the Target ID of a SCSI device on\r
726 the SCSI channel.\r
727 @param[out] Lun A pointer to the LUN of a SCSI device on the SCSI\r
728 channel.\r
729\r
730 @retval EFI_SUCCESS DevicePath was successfully translated to a\r
731 Target ID and LUN, and they were returned in\r
732 Target and Lun.\r
733 @retval EFI_INVALID_PARAMETER DevicePath/Target/Lun is NULL.\r
734 @retval EFI_UNSUPPORTED This driver does not support the device path node\r
735 type in DevicePath.\r
736 @retval EFI_NOT_FOUND A valid translation from DevicePath to a Target\r
737 ID and LUN does not exist.\r
738\r
739**/\r
740EFI_STATUS\r
741EFIAPI\r
742IScsiExtScsiPassThruGetTargetLun (\r
743 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
744 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
745 OUT UINT8 **Target,\r
746 OUT UINT64 *Lun\r
747 );\r
748\r
749/**\r
750 Resets a SCSI channel.This operation resets all the SCSI devices connected to\r
751 the SCSI channel.\r
752\r
753 @param[in] This Protocol instance pointer.\r
754\r
755 @retval EFI_UNSUPPORTED It is not supported.\r
756\r
757**/\r
758EFI_STATUS\r
759EFIAPI\r
760IScsiExtScsiPassThruResetChannel (\r
761 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This\r
762 );\r
763\r
764/**\r
765 Resets a SCSI device that is connected to a SCSI channel.\r
766\r
767 @param[in] This Protocol instance pointer.\r
768 @param[in] Target The Target ID of the SCSI device to reset.\r
769 @param[in] Lun The LUN of the SCSI device to reset.\r
770\r
771 @retval EFI_UNSUPPORTED It is not supported.\r
772\r
773**/\r
774EFI_STATUS\r
775EFIAPI\r
776IScsiExtScsiPassThruResetTargetLun (\r
777 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
778 IN UINT8 *Target,\r
779 IN UINT64 Lun\r
780 );\r
781\r
782/**\r
783 Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. \r
784\r
785 @param[in] This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL\r
786 instance.\r
787 @param[in, out] Target (TARGET_MAX_BYTES) of a SCSI device present on\r
788 the SCSI channel. On output, a pointer to the\r
789 Target ID (an array of TARGET_MAX_BYTES) of the\r
790 next SCSI device present on a SCSI channel.\r
791 An input value of 0xF(all bytes in the array are 0xF)\r
792 in the Target array retrieves the Target ID of the\r
793 first SCSI device present on a SCSI channel. \r
794\r
795 @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI\r
796 channel was returned in Target.\r
797 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
798 @retval EFI_TIMEOUT Target array is not all 0xF, and Target was not\r
799 returned on a previous call to GetNextTarget().\r
800 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r
801\r
802**/\r
803EFI_STATUS\r
804EFIAPI\r
805IScsiExtScsiPassThruGetNextTarget (\r
806 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
807 IN OUT UINT8 **Target\r
808 );\r
809\r
810#endif\r