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