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