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