]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.h
4f509fb32ebb794b550d0c11006ab19e2ef2c0a2
[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[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
60 @param[in] 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[in] 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[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
100 @param[in] 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[in] 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.
108 Currently not implemented.
109 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
110 @retval Others 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[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
136 @param[in] 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[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.Not used.
140 @param[in] 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 /**
160 Retrieves a Unicode string that is the user readable name of the EFI Driver.
161
162 This function retrieves the user readable name of a driver in the form of a
163 Unicode string. If the driver specified by This has a user readable name in
164 the language specified by Language, then a pointer to the driver name is
165 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
166 by This does not support the language specified by Language,
167 then EFI_UNSUPPORTED is returned.
168
169 @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
170 @param[in] Language A pointer to a three character ISO 639-2 language identifier.
171 This is the language of the driver name that that the caller
172 is requesting, and it must match one of the languages specified
173 in SupportedLanguages. The number of languages supported by a
174 driver is up to the driver writer.
175 @param[out] DriverName A pointer to the Unicode string to return. This Unicode string
176 is the name of the driver specified by This in the language
177 specified by Language.
178
179 @retval EFI_SUCCESS The Unicode string for the Driver specified by This
180 and the language specified by Language was returned
181 in DriverName.
182 @retval EFI_INVALID_PARAMETER Language is NULL.
183 @retval EFI_INVALID_PARAMETER DriverName is NULL.
184 @retval EFI_UNSUPPORTED The driver specified by This does not support the
185 language specified by Language.
186 **/
187 EFI_STATUS
188 EFIAPI
189 IScsiComponentNameGetDriverName (
190 IN EFI_COMPONENT_NAME_PROTOCOL *This,
191 IN CHAR8 *Language,
192 OUT CHAR16 **DriverName
193 );
194
195 /**
196 Retrieves a Unicode string that is the user readable name of the controller
197 that is being managed by an EFI Driver.Currently not implemented.
198
199 @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
200 @param[in] ControllerHandle The handle of a controller that the driver specified by
201 This is managing. This handle specifies the controller
202 whose name is to be returned.
203 @param[in] ChildHandle The handle of the child controller to retrieve the name
204 of. This is an optional parameter that may be NULL. It
205 will be NULL for device drivers. It will also be NULL
206 for a bus drivers that wish to retrieve the name of the
207 bus controller. It will not be NULL for a bus driver
208 that wishes to retrieve the name of a child controller.
209 @param[in] Language A pointer to a three character ISO 639-2 language
210 identifier. This is the language of the controller name
211 that that the caller is requesting, and it must match one
212 of the languages specified in SupportedLanguages. The
213 number of languages supported by a driver is up to the
214 driver writer.
215 @param[out] ControllerName A pointer to the Unicode string to return. This Unicode
216 string is the name of the controller specified by
217 ControllerHandle and ChildHandle in the language specified
218 by Language from the point of view of the driver specified
219 by This.
220
221 @retval EFI_SUCCESS The Unicode string for the user readable name in the
222 language specified by Language for the driver
223 specified by This was returned in DriverName.
224 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
225 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
226 @retval EFI_INVALID_PARAMETER Language is NULL.
227 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
228 @retval EFI_UNSUPPORTED The driver specified by This is not currently managing
229 the controller specified by ControllerHandle and
230 ChildHandle.
231 @retval EFI_UNSUPPORTED The driver specified by This does not support the
232 language specified by Language.
233 **/
234 EFI_STATUS
235 EFIAPI
236 IScsiComponentNameGetControllerName (
237 IN EFI_COMPONENT_NAME_PROTOCOL *This,
238 IN EFI_HANDLE ControllerHandle,
239 IN EFI_HANDLE ChildHandle OPTIONAL,
240 IN CHAR8 *Language,
241 OUT CHAR16 **ControllerName
242 );
243
244 ///
245 /// EFI IScsi Initiator Name Protocol for IScsi driver.
246 ///
247
248 /**
249 Retrieves the current set value of iSCSI Initiator Name.
250
251 @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
252 @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer / Actual size of the
253 variable data buffer.
254 @param[out] Buffer Pointer to the buffer for data to be read.
255
256 @retval EFI_SUCCESS Data was successfully retrieved into the provided buffer and the
257 BufferSize was sufficient to handle the iSCSI initiator name
258 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result.
259 @retval EFI_INVALID_PARAMETER BufferSize or Buffer is NULL.
260 @retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved due to a hardware error.
261 @retval Others Some unexpected error happened.
262 **/
263 EFI_STATUS
264 EFIAPI
265 IScsiGetInitiatorName (
266 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,
267 IN OUT UINTN *BufferSize,
268 OUT VOID *Buffer
269 );
270
271 /**
272 Sets the iSCSI Initiator Name.
273
274 @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
275 @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer.
276 @param[in] Buffer Pointer to the buffer for data to be written.
277
278 @retval EFI_SUCCESS Data was successfully stored by the protocol.
279 @retval EFI_UNSUPPORTED Platform policies do not allow for data to be written.
280 Currently not implemented.
281 @retval EFI_INVALID_PARAMETER BufferSize or Buffer is NULL, or BufferSize exceeds the maximum allowed limit.
282 @retval EFI_DEVICE_ERROR The data could not be stored due to a hardware error.
283 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data.
284 @retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC 3720
285 (and other related protocols)
286 @retval Others Some unexpected error happened.
287 **/
288 EFI_STATUS
289 EFIAPI
290 IScsiSetInitiatorName (
291 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,
292 IN OUT UINTN *BufferSize,
293 IN VOID *Buffer
294 );
295
296 #endif