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