]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.h
sync comments, fix function header, rename variable name to follow coding style.
[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
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 Module Name:
14
15 IScsiDriver.h
16
17 Abstract:
18 The header file of IScsiDriver.c
19
20 **/
21
22 #ifndef _ISCSI_DRIVER_H_
23 #define _ISCSI_DRIVER_H_
24
25 #include <PiDxe.h>
26 #include <Protocol/DevicePath.h>
27 #include <Protocol/LoadedImage.h>
28 #include <Protocol/HiiConfigAccess.h>
29 #include <Protocol/HiiDatabase.h>
30 #include <Library/UefiDriverEntryPoint.h>
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <Library/UefiLib.h>
33 #include <Library/DevicePathLib.h>
34 #include <Protocol/DriverBinding.h>
35 #include <Protocol/ScsiPassThruExt.h>
36 #include <Protocol/IScsiInitiatorName.h>
37 #include <Protocol/Ip4Config.h>
38 #include <Protocol/ComponentName.h>
39 #include <Protocol/ComponentName2.h>
40
41 #define ISCSI_PRIVATE_GUID \
42 { 0xfa3cde4c, 0x87c2, 0x427d, {0xae, 0xde, 0x7d, 0xd0, 0x96, 0xc8, 0x8c, 0x58} }
43
44 #define ISCSI_INITIATOR_NAME_VAR_NAME L"I_NAME"
45
46 extern EFI_COMPONENT_NAME2_PROTOCOL gIScsiComponentName2;
47 extern EFI_COMPONENT_NAME_PROTOCOL gIScsiComponentName;
48
49 extern EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName;
50
51 extern EFI_GUID mIScsiPrivateGuid;
52
53 typedef struct _ISCSI_PRIVATE_PROTOCOL {
54 UINT32 Reserved;
55 } ISCSI_PRIVATE_PROTOCOL;
56
57 //
58 // EFI Driver Binding Protocol for iSCSI driver.
59 //
60 /**
61 Test to see if IScsi driver supports the given controller.
62
63 @param This[in] Protocol instance pointer.
64
65 @param ControllerHandle[in] Handle of controller to test.
66
67 @param RemainingDevicePath[in] Optional parameter use to pick a specific child device to start.
68
69 @retval EFI_SUCCES This driver supports the controller.
70
71 @retval EFI_ALREADY_STARTED This driver is already running on this device.
72
73 @retval EFI_UNSUPPORTED This driver doesn't support the controller.
74
75 **/
76 EFI_STATUS
77 EFIAPI
78 IScsiDriverBindingSupported (
79 IN EFI_DRIVER_BINDING_PROTOCOL *This,
80 IN EFI_HANDLE ControllerHandle,
81 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
82 );
83
84 /**
85 Start to manage the controller.
86
87 @param This[in] Protocol instance pointer.
88
89 @param ControllerHandle[in] Handle of the controller.
90
91 @param RemainingDevicePath[in] Optional parameter use to pick a specific child device to start.
92
93 @retval EFI_SUCCES This driver supports this device.
94
95 @retval EFI_ALREADY_STARTED This driver is already running on this device.
96
97 **/
98 EFI_STATUS
99 EFIAPI
100 IScsiDriverBindingStart (
101 IN EFI_DRIVER_BINDING_PROTOCOL *This,
102 IN EFI_HANDLE ControllerHandle,
103 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
104 );
105
106 /**
107 Release the control of this controller and remove the IScsi functions.
108
109 @param This[in] Protocol instance pointer.
110
111 @param ControllerHandle[in] Handle of controller to stop.
112
113 @param NumberOfChildren[in] Not used.
114
115 @param ChildHandleBuffer[in] Not used.
116
117 @retval EFI_SUCCES This driver supports this device.
118
119 **/
120 EFI_STATUS
121 EFIAPI
122 IScsiDriverBindingStop (
123 IN EFI_DRIVER_BINDING_PROTOCOL *This,
124 IN EFI_HANDLE ControllerHandle,
125 IN UINTN NumberOfChildren,
126 IN EFI_HANDLE *ChildHandleBuffer
127 );
128
129 //
130 // EFI Component Name Protocol for IScsi driver.
131 //
132 /**
133 Retrieves a Unicode string that is the user readable name of the EFI Driver.
134
135 This function retrieves the user readable name of a driver in the form of a
136 Unicode string. If the driver specified by This has a user readable name in
137 the language specified by Language, then a pointer to the driver name is
138 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
139 by This does not support the language specified by Language,
140 then EFI_UNSUPPORTED is returned.
141
142 @param This[in] A pointer to the EFI_COMPONENT_NAME_PROTOCOL
143 instance.
144
145 @param Language[in] A pointer to a three character ISO 639-2 language
146 identifier.
147 This is the language of the driver name that that
148 the caller is requesting, and it must match one of
149 the languages specified in SupportedLanguages.
150 The number of languages supported by a driver is up
151 to the driver writer.
152
153 @param DriverName[out] A pointer to the Unicode string to return.
154 This Unicode string is the name of the
155 driver specified by This in the language
156 specified by Language.
157
158 @retval EFI_SUCCESS The Unicode string for the Driver specified by
159 This and the language specified by Language was
160 returned in DriverName.
161
162 @retval EFI_INVALID_PARAMETER Language is NULL.
163
164 @retval EFI_INVALID_PARAMETER DriverName is NULL.
165
166 @retval EFI_UNSUPPORTED The driver specified by This does not support
167 the language specified by Language.
168
169 **/
170 EFI_STATUS
171 EFIAPI
172 IScsiComponentNameGetDriverName (
173 IN EFI_COMPONENT_NAME_PROTOCOL *This,
174 IN CHAR8 *Language,
175 OUT CHAR16 **DriverName
176 );
177
178 /**
179 Retrieves a Unicode string that is the user readable name of the controller
180 that is being managed by an EFI Driver.
181
182 @param This[in] A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
183
184 @param ControllerHandle[in] The handle of a controller that the driver specified by
185 This is managing. This handle specifies the controller
186 whose name is to be returned.
187
188 @param ChildHandle[in] The handle of the child controller to retrieve the name
189 of. This is an optional parameter that may be NULL. It
190 will be NULL for device drivers. It will also be NULL
191 for a bus drivers that wish to retrieve the name of the
192 bus controller. It will not be NULL for a bus driver
193 that wishes to retrieve the name of a child controller.
194
195 @param Language[in] A pointer to a three character ISO 639-2 language
196 identifier. This is the language of the controller name
197 that that the caller is requesting, and it must match one
198 of the languages specified in SupportedLanguages. The
199 number of languages supported by a driver is up to the
200 driver writer.
201
202 @param ControllerName[out] A pointer to the Unicode string to return. This Unicode
203 string is the name of the controller specified by
204 ControllerHandle and ChildHandle in the language
205 specified by Language from the point of view of the
206 driver specified by This.
207
208 @retval EFI_SUCCESS The Unicode string for the user readable name in the
209 language specified by Language for the driver
210 specified by This was returned in DriverName.
211
212 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
213
214 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
215
216 @retval EFI_INVALID_PARAMETER Language is NULL.
217
218 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
219
220 @retval EFI_UNSUPPORTED The driver specified by This is not currently managing
221 the controller specified by ControllerHandle and ChildHandle.
222
223 @retval EFI_UNSUPPORTED The driver specified by This does not support the
224 language specified by Language.
225
226 **/
227 EFI_STATUS
228 EFIAPI
229 IScsiComponentNameGetControllerName (
230 IN EFI_COMPONENT_NAME_PROTOCOL *This,
231 IN EFI_HANDLE ControllerHandle,
232 IN EFI_HANDLE ChildHandle OPTIONAL,
233 IN CHAR8 *Language,
234 OUT CHAR16 **ControllerName
235 );
236
237 //
238 // EFI IScsi Initiator Name Protocol for IScsi driver.
239 //
240 /**
241 Retrieves the current set value of iSCSI Initiator Name.
242
243 @param This[in] Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
244
245 @param BufferSize[in][out] Size of the buffer in bytes pointed to by Buffer / Actual
246 size of the variable data buffer.
247
248 @param Buffer[out] Pointer to the buffer for data to be read.
249
250 @retval EFI_SUCCESS Data was successfully retrieved into the provided
251 buffer and the BufferSize was sufficient to handle the
252 iSCSI initiator name.
253 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result. BufferSize will
254 be updated with the size required to complete the request.
255 Buffer will not be affected.
256
257 @retval EFI_INVALID_PARAMETER BufferSize is NULL. BufferSize and Buffer will not be
258 affected.
259
260 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be
261 affected.
262
263 @retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved due to
264 a hardware error.
265
266 **/
267 EFI_STATUS
268 EFIAPI
269 IScsiGetInitiatorName (
270 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,
271 IN OUT UINTN *BufferSize,
272 OUT VOID *Buffer
273 );
274
275 /**
276 Sets the iSCSI Initiator Name.
277
278 @param This[in] Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
279
280 @param BufferSize[in][out] Size of the buffer in bytes pointed to by Buffer.
281
282 @param Buffer[out] Pointer to the buffer for data to be written.
283
284 @retval EFI_SUCCESS Data was successfully stored by the protocol.
285
286 @retval EFI_UNSUPPORTED Platform policies do not allow for data to be written.
287
288 @retval EFI_INVALID_PARAMETER BufferSize exceeds the maximum allowed limit.
289 BufferSize will be updated with the maximum size
290 required to complete the request.
291
292 @retval EFI_INVALID_PARAMETER Buffersize is NULL. BufferSize and Buffer will not be
293 affected.
294
295 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be affected.
296
297 @retval EFI_DEVICE_ERROR The data could not be stored due to a hardware error.
298
299 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data.
300
301 @retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC 3720.
302
303 **/
304 EFI_STATUS
305 EFIAPI
306 IScsiSetInitiatorName (
307 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,
308 IN OUT UINTN *BufferSize,
309 OUT VOID *Buffer
310 );
311
312 #endif