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