IScsiDriver.h 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. /** @file
  2. The header file of IScsiDriver.c.
  3. Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
  4. (C) Copyright 2017 Hewlett Packard Enterprise Development LP<BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #ifndef _ISCSI_DRIVER_H_
  8. #define _ISCSI_DRIVER_H_
  9. #define ISCSI_V4_PRIVATE_GUID \
  10. { \
  11. 0xfa3cde4c, 0x87c2, 0x427d, { 0xae, 0xde, 0x7d, 0xd0, 0x96, 0xc8, 0x8c, 0x58 } \
  12. }
  13. #define ISCSI_V6_PRIVATE_GUID \
  14. { \
  15. 0x28be27e5, 0x66cc, 0x4a31, { 0xa3, 0x15, 0xdb, 0x14, 0xc3, 0x74, 0x4d, 0x85 } \
  16. }
  17. #define ISCSI_INITIATOR_NAME_VAR_NAME L"I_NAME"
  18. #define IP_MODE_AUTOCONFIG_IP4 3
  19. #define IP_MODE_AUTOCONFIG_IP6 4
  20. #define ALWAYS_USE_UEFI_ISCSI_AND_IGNORE_ISCSI_HBA 0x00
  21. #define STOP_UEFI_ISCSI_IF_HBA_INSTALL_AIP 0x01
  22. #define STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP4 0x02
  23. #define STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP6 0x04
  24. #define STOP_UEFI_ISCSI_IF_AIP_SUPPORT_OFFLOAD 0x08
  25. #define STOP_UEFI_ISCSI_IF_AIP_SUPPORT_MPIO 0x10
  26. #define STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP4 0x20
  27. #define STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP6 0x40
  28. #define ALWAYS_USE_ISCSI_HBA_AND_IGNORE_UEFI_ISCSI 0xFF
  29. extern EFI_COMPONENT_NAME2_PROTOCOL gIScsiComponentName2;
  30. extern EFI_COMPONENT_NAME_PROTOCOL gIScsiComponentName;
  31. extern EFI_UNICODE_STRING_TABLE *gIScsiControllerNameTable;
  32. extern EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName;
  33. extern EFI_AUTHENTICATION_INFO_PROTOCOL gIScsiAuthenticationInfo;
  34. extern EFI_EXT_SCSI_PASS_THRU_PROTOCOL gIScsiExtScsiPassThruProtocolTemplate;
  35. extern EFI_GUID gIScsiV4PrivateGuid;
  36. extern EFI_GUID gIScsiV6PrivateGuid;
  37. typedef struct {
  38. CHAR16 PortString[ISCSI_NAME_IFR_MAX_SIZE];
  39. LIST_ENTRY NicInfoList;
  40. UINT8 NicCount;
  41. UINT8 CurrentNic;
  42. UINT8 MaxNic;
  43. BOOLEAN Ipv6Flag;
  44. BOOLEAN OneSessionEstablished;
  45. BOOLEAN EnableMpio;
  46. UINT8 MpioCount; // The number of attempts in MPIO.
  47. UINT8 Krb5MpioCount; // The number of attempts login with KRB5 in MPIO.
  48. UINT8 SinglePathCount; // The number of single path attempts.
  49. UINT8 ValidSinglePathCount; // The number of valid single path attempts.
  50. UINT8 BootSelectedIndex;
  51. UINT8 AttemptCount;
  52. LIST_ENTRY AttemptConfigs; // User configured Attempt list.
  53. CHAR8 InitiatorName[ISCSI_NAME_MAX_SIZE];
  54. UINTN InitiatorNameLength;
  55. } ISCSI_PRIVATE_DATA;
  56. extern ISCSI_PRIVATE_DATA *mPrivate;
  57. typedef struct {
  58. LIST_ENTRY Link;
  59. UINT32 HwAddressSize;
  60. EFI_MAC_ADDRESS PermanentAddress;
  61. UINT8 NicIndex;
  62. UINT16 VlanId;
  63. UINTN BusNumber;
  64. UINTN DeviceNumber;
  65. UINTN FunctionNumber;
  66. BOOLEAN Ipv6Available;
  67. } ISCSI_NIC_INFO;
  68. typedef struct _ISCSI_PRIVATE_PROTOCOL {
  69. UINT32 Reserved;
  70. } ISCSI_PRIVATE_PROTOCOL;
  71. //
  72. // EFI Driver Binding Protocol for iSCSI driver.
  73. //
  74. /**
  75. Tests to see if this driver supports a given controller. If a child device is provided,
  76. it tests to see if this driver supports creating a handle for the specified child device.
  77. This function checks to see if the driver specified by This supports the device specified by
  78. ControllerHandle. Drivers typically use the device path attached to
  79. ControllerHandle and/or the services from the bus I/O abstraction attached to
  80. ControllerHandle to determine if the driver supports ControllerHandle. This function
  81. may be called many times during platform initialization. In order to reduce boot times, the tests
  82. performed by this function must be very small and take as little time as possible to execute. This
  83. function must not change the state of any hardware devices, and this function must be aware that the
  84. device specified by ControllerHandle may already be managed by the same driver or a
  85. different driver. This function must match its calls to AllocatePages() with FreePages(),
  86. AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
  87. Since ControllerHandle may have been previously started by the same driver, if a protocol is
  88. already in the opened state, then it must not be closed with CloseProtocol(). This is required
  89. to guarantee the state of ControllerHandle is not modified by this function.
  90. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
  91. @param[in] ControllerHandle The handle of the controller to test. This handle
  92. must support a protocol interface that supplies
  93. an I/O abstraction to the driver.
  94. @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
  95. parameter is ignored by device drivers, and is optional for bus
  96. drivers. For bus drivers, if this parameter is not NULL, then
  97. the bus driver must determine if the bus controller specified
  98. by ControllerHandle and the child controller specified
  99. by RemainingDevicePath are both supported by this
  100. bus driver.
  101. @retval EFI_SUCCESS The device specified by ControllerHandle and
  102. RemainingDevicePath is supported by the driver specified by This.
  103. @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
  104. RemainingDevicePath is already managed by the driver
  105. specified by This.
  106. @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
  107. RemainingDevicePath is already managed by a different
  108. driver or an application that requires exclusive access.
  109. Currently not implemented.
  110. @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
  111. RemainingDevicePath is not supported by the driver specified by This.
  112. **/
  113. EFI_STATUS
  114. EFIAPI
  115. IScsiIp4DriverBindingSupported (
  116. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  117. IN EFI_HANDLE ControllerHandle,
  118. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
  119. );
  120. /**
  121. Starts a device controller or a bus controller.
  122. The Start() function is designed to be invoked from the EFI boot service ConnectController().
  123. As a result, much of the error checking on the parameters to Start() has been moved into this
  124. common boot service. It is legal to call Start() from other locations,
  125. but the following calling restrictions must be followed or the system behavior will not be deterministic.
  126. 1. ControllerHandle must be a valid EFI_HANDLE.
  127. 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
  128. EFI_DEVICE_PATH_PROTOCOL.
  129. 3. Prior to calling Start(), the Supported() function for the driver specified by This must
  130. have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
  131. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
  132. @param[in] ControllerHandle The handle of the controller to start. This handle
  133. must support a protocol interface that supplies
  134. an I/O abstraction to the driver.
  135. @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
  136. parameter is ignored by device drivers, and is optional for bus
  137. drivers. For a bus driver, if this parameter is NULL, then handles
  138. for all the children of Controller are created by this driver.
  139. If this parameter is not NULL and the first Device Path Node is
  140. not the End of Device Path Node, then only the handle for the
  141. child device specified by the first Device Path Node of
  142. RemainingDevicePath is created by this driver.
  143. If the first Device Path Node of RemainingDevicePath is
  144. the End of Device Path Node, no child handle is created by this
  145. driver.
  146. @retval EFI_SUCCESS The device was started.
  147. @retval EFI_DEVICE_ERROR The device could not be started due to a device error. Currently not implemented.
  148. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
  149. @retval Others The driver failed to start the device.
  150. **/
  151. EFI_STATUS
  152. EFIAPI
  153. IScsiIp4DriverBindingStart (
  154. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  155. IN EFI_HANDLE ControllerHandle,
  156. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
  157. );
  158. /**
  159. Stops a device controller or a bus controller.
  160. The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
  161. As a result, much of the error checking on the parameters to Stop() has been moved
  162. into this common boot service. It is legal to call Stop() from other locations,
  163. but the following calling restrictions must be followed or the system behavior will not be deterministic.
  164. 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
  165. same driver's Start() function.
  166. 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
  167. EFI_HANDLE. In addition, all of these handles must have been created in this driver's
  168. Start() function, and the Start() function must have called OpenProtocol() on
  169. ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
  170. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
  171. @param[in] ControllerHandle A handle to the device being stopped. The handle must
  172. support a bus specific I/O protocol for the driver
  173. to use to stop the device.
  174. @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
  175. @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
  176. if NumberOfChildren is 0.
  177. @retval EFI_SUCCESS The device was stopped.
  178. @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
  179. **/
  180. EFI_STATUS
  181. EFIAPI
  182. IScsiIp4DriverBindingStop (
  183. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  184. IN EFI_HANDLE ControllerHandle,
  185. IN UINTN NumberOfChildren,
  186. IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
  187. );
  188. /**
  189. Tests to see if this driver supports a given controller. If a child device is provided,
  190. it tests to see if this driver supports creating a handle for the specified child device.
  191. This function checks to see if the driver specified by This supports the device specified by
  192. ControllerHandle. Drivers typically use the device path attached to
  193. ControllerHandle and/or the services from the bus I/O abstraction attached to
  194. ControllerHandle to determine if the driver supports ControllerHandle. This function
  195. may be called many times during platform initialization. In order to reduce boot times, the tests
  196. performed by this function must be very small and take as little time as possible to execute. This
  197. function must not change the state of any hardware devices, and this function must be aware that the
  198. device specified by ControllerHandle may already be managed by the same driver or a
  199. different driver. This function must match its calls to AllocatePages() with FreePages(),
  200. AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
  201. Since ControllerHandle may have been previously started by the same driver, if a protocol is
  202. already in the opened state, then it must not be closed with CloseProtocol(). This is required
  203. to guarantee the state of ControllerHandle is not modified by this function.
  204. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
  205. @param[in] ControllerHandle The handle of the controller to test. This handle
  206. must support a protocol interface that supplies
  207. an I/O abstraction to the driver.
  208. @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
  209. parameter is ignored by device drivers, and is optional for bus
  210. drivers. For bus drivers, if this parameter is not NULL, then
  211. the bus driver must determine if the bus controller specified
  212. by ControllerHandle and the child controller specified
  213. by RemainingDevicePath are both supported by this
  214. bus driver.
  215. @retval EFI_SUCCESS The device specified by ControllerHandle and
  216. RemainingDevicePath is supported by the driver specified by This.
  217. @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
  218. RemainingDevicePath is already managed by the driver
  219. specified by This.
  220. @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
  221. RemainingDevicePath is already managed by a different
  222. driver or an application that requires exclusive access.
  223. Currently not implemented.
  224. @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
  225. RemainingDevicePath is not supported by the driver specified by This.
  226. **/
  227. EFI_STATUS
  228. EFIAPI
  229. IScsiIp6DriverBindingSupported (
  230. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  231. IN EFI_HANDLE ControllerHandle,
  232. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
  233. );
  234. /**
  235. Starts a device controller or a bus controller.
  236. The Start() function is designed to be invoked from the EFI boot service ConnectController().
  237. As a result, much of the error checking on the parameters to Start() has been moved into this
  238. common boot service. It is legal to call Start() from other locations,
  239. but the following calling restrictions must be followed or the system behavior will not be deterministic.
  240. 1. ControllerHandle must be a valid EFI_HANDLE.
  241. 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
  242. EFI_DEVICE_PATH_PROTOCOL.
  243. 3. Prior to calling Start(), the Supported() function for the driver specified by This must
  244. have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
  245. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
  246. @param[in] ControllerHandle The handle of the controller to start. This handle
  247. must support a protocol interface that supplies
  248. an I/O abstraction to the driver.
  249. @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
  250. parameter is ignored by device drivers, and is optional for bus
  251. drivers. For a bus driver, if this parameter is NULL, then handles
  252. for all the children of Controller are created by this driver.
  253. If this parameter is not NULL and the first Device Path Node is
  254. not the End of Device Path Node, then only the handle for the
  255. child device specified by the first Device Path Node of
  256. RemainingDevicePath is created by this driver.
  257. If the first Device Path Node of RemainingDevicePath is
  258. the End of Device Path Node, no child handle is created by this
  259. driver.
  260. @retval EFI_SUCCESS The device was started.
  261. @retval EFI_DEVICE_ERROR The device could not be started due to a device error. Currently not implemented.
  262. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
  263. @retval Others The driver failed to start the device.
  264. **/
  265. EFI_STATUS
  266. EFIAPI
  267. IScsiIp6DriverBindingStart (
  268. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  269. IN EFI_HANDLE ControllerHandle,
  270. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
  271. );
  272. /**
  273. Stops a device controller or a bus controller.
  274. The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
  275. As a result, much of the error checking on the parameters to Stop() has been moved
  276. into this common boot service. It is legal to call Stop() from other locations,
  277. but the following calling restrictions must be followed or the system behavior will not be deterministic.
  278. 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
  279. same driver's Start() function.
  280. 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
  281. EFI_HANDLE. In addition, all of these handles must have been created in this driver's
  282. Start() function, and the Start() function must have called OpenProtocol() on
  283. ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
  284. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
  285. @param[in] ControllerHandle A handle to the device being stopped. The handle must
  286. support a bus specific I/O protocol for the driver
  287. to use to stop the device.
  288. @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
  289. @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
  290. if NumberOfChildren is 0.
  291. @retval EFI_SUCCESS The device was stopped.
  292. @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
  293. **/
  294. EFI_STATUS
  295. EFIAPI
  296. IScsiIp6DriverBindingStop (
  297. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  298. IN EFI_HANDLE ControllerHandle,
  299. IN UINTN NumberOfChildren,
  300. IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
  301. );
  302. //
  303. // EFI Component Name(2) Protocol for iSCSI driver.
  304. //
  305. /**
  306. Retrieves a Unicode string that is the user readable name of the driver.
  307. This function retrieves the user readable name of a driver in the form of a
  308. Unicode string. If the driver specified by This has a user readable name in
  309. the language specified by Language, then a pointer to the driver name is
  310. returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
  311. by This does not support the language specified by Language,
  312. then EFI_UNSUPPORTED is returned.
  313. @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
  314. EFI_COMPONENT_NAME_PROTOCOL instance.
  315. @param[in] Language A pointer to a Null-terminated ASCII string
  316. array indicating the language. This is the
  317. language of the driver name that the caller is
  318. requesting, and it must match one of the
  319. languages specified in SupportedLanguages. The
  320. number of languages supported by a driver is up
  321. to the driver writer. Language is specified
  322. in RFC 4646 or ISO 639-2 language code format.
  323. @param[out] DriverName A pointer to the Unicode string to return.
  324. This Unicode string is the name of the
  325. driver specified by This in the language
  326. specified by Language.
  327. @retval EFI_SUCCESS The Unicode string for the Driver specified by
  328. This and the language specified by Language was
  329. returned in DriverName.
  330. @retval EFI_INVALID_PARAMETER Language is NULL.
  331. @retval EFI_INVALID_PARAMETER DriverName is NULL.
  332. @retval EFI_UNSUPPORTED The driver specified by This does not support
  333. the language specified by Language.
  334. **/
  335. EFI_STATUS
  336. EFIAPI
  337. IScsiComponentNameGetDriverName (
  338. IN EFI_COMPONENT_NAME_PROTOCOL *This,
  339. IN CHAR8 *Language,
  340. OUT CHAR16 **DriverName
  341. );
  342. /**
  343. Retrieves a Unicode string that is the user readable name of the controller
  344. that is being managed by a driver.
  345. This function retrieves the user readable name of the controller specified by
  346. ControllerHandle and ChildHandle in the form of a Unicode string. If the
  347. driver specified by This has a user readable name in the language specified by
  348. Language, then a pointer to the controller name is returned in ControllerName,
  349. and EFI_SUCCESS is returned. If the driver specified by This is not currently
  350. managing the controller specified by ControllerHandle and ChildHandle,
  351. then EFI_UNSUPPORTED is returned. If the driver specified by This does not
  352. support the language specified by Language, then EFI_UNSUPPORTED is returned.
  353. @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
  354. EFI_COMPONENT_NAME_PROTOCOL instance.
  355. @param[in] ControllerHandle The handle of a controller that the driver
  356. specified by This is managing. This handle
  357. specifies the controller whose name is to be
  358. returned.
  359. @param[in] ChildHandle The handle of the child controller to retrieve
  360. the name of. This is an optional parameter that
  361. may be NULL. It will be NULL for device
  362. drivers. It will also be NULL for a bus drivers
  363. that wish to retrieve the name of the bus
  364. controller. It will not be NULL for a bus
  365. driver that wishes to retrieve the name of a
  366. child controller.
  367. @param[in] Language A pointer to a Null-terminated ASCII string
  368. array indicating the language. This is the
  369. language of the driver name that the caller is
  370. requesting, and it must match one of the
  371. languages specified in SupportedLanguages. The
  372. number of languages supported by a driver is
  373. determined by the driver writer. Language is
  374. specified inRFC 4646 or ISO 639-2 language code
  375. format.
  376. @param[out] ControllerName A pointer to the Unicode string to return.
  377. This Unicode string is the name of the
  378. controller specified by ControllerHandle and
  379. ChildHandle in the language specified by
  380. Language from the point of view of the driver
  381. specified by This.
  382. @retval EFI_SUCCESS The Unicode string for the user readable name in
  383. the language specified by Language for the
  384. driver specified by This was returned in
  385. DriverName.
  386. @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
  387. @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
  388. EFI_HANDLE.
  389. @retval EFI_INVALID_PARAMETER Language is NULL.
  390. @retval EFI_INVALID_PARAMETER ControllerName is NULL.
  391. @retval EFI_UNSUPPORTED The driver specified by This is not currently
  392. managing the controller specified by
  393. ControllerHandle and ChildHandle.
  394. @retval EFI_UNSUPPORTED The driver specified by This does not support
  395. the language specified by Language.
  396. **/
  397. EFI_STATUS
  398. EFIAPI
  399. IScsiComponentNameGetControllerName (
  400. IN EFI_COMPONENT_NAME_PROTOCOL *This,
  401. IN EFI_HANDLE ControllerHandle,
  402. IN EFI_HANDLE ChildHandle OPTIONAL,
  403. IN CHAR8 *Language,
  404. OUT CHAR16 **ControllerName
  405. );
  406. //
  407. // EFI iSCSI Initiator Name Protocol for iSCSI driver.
  408. //
  409. /**
  410. Retrieves the current set value of iSCSI Initiator Name.
  411. @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL
  412. instance.
  413. @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer /
  414. Actual size of the variable data buffer.
  415. @param[out] Buffer Pointer to the buffer for data to be read.
  416. @retval EFI_SUCCESS Data was successfully retrieved into the provided
  417. buffer and the BufferSize was sufficient to handle
  418. the iSCSI initiator name.
  419. @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result. BufferSize
  420. will be updated with the size required to complete
  421. the request. Buffer will not be affected.
  422. @retval EFI_INVALID_PARAMETER BufferSize is NULL. BufferSize and Buffer will not
  423. be affected.
  424. @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be
  425. affected.
  426. @retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved
  427. due to a hardware error.
  428. **/
  429. EFI_STATUS
  430. EFIAPI
  431. IScsiGetInitiatorName (
  432. IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,
  433. IN OUT UINTN *BufferSize,
  434. OUT VOID *Buffer
  435. );
  436. /**
  437. Sets the iSSI Initiator Name.
  438. @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL
  439. instance.
  440. @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer.
  441. @param[in] Buffer Pointer to the buffer for data to be written.
  442. @retval EFI_SUCCESS Data was successfully stored by the protocol.
  443. @retval EFI_UNSUPPORTED Platform policies do not allow for data to be
  444. written.
  445. @retval EFI_INVALID_PARAMETER BufferSize exceeds the maximum allowed limit.
  446. BufferSize will be updated with the maximum size
  447. required to complete the request.
  448. @retval EFI_INVALID_PARAMETER Buffersize is NULL. BufferSize and Buffer will not
  449. be affected.
  450. @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be
  451. affected.
  452. @retval EFI_DEVICE_ERROR The data could not be stored due to a hardware
  453. error.
  454. @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data
  455. @retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC
  456. 3720
  457. **/
  458. EFI_STATUS
  459. EFIAPI
  460. IScsiSetInitiatorName (
  461. IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,
  462. IN OUT UINTN *BufferSize,
  463. IN VOID *Buffer
  464. );
  465. //
  466. // EFI_AUTHENTICATION_INFO_PROTOCOL for iSCSI driver.
  467. //
  468. /**
  469. Retrieves the authentication information associated with a particular controller handle.
  470. @param[in] This Pointer to the EFI_AUTHENTICATION_INFO_PROTOCOL.
  471. @param[in] ControllerHandle Handle to the Controller.
  472. @param[out] Buffer Pointer to the authentication information. This function is
  473. responsible for allocating the buffer and it is the caller's
  474. responsibility to free buffer when the caller is finished with buffer.
  475. @retval EFI_DEVICE_ERROR The authentication information could not be
  476. retrieved due to a hardware error.
  477. **/
  478. EFI_STATUS
  479. EFIAPI
  480. IScsiGetAuthenticationInfo (
  481. IN EFI_AUTHENTICATION_INFO_PROTOCOL *This,
  482. IN EFI_HANDLE ControllerHandle,
  483. OUT VOID **Buffer
  484. );
  485. /**
  486. Set the authentication information for a given controller handle.
  487. @param[in] This Pointer to the EFI_AUTHENTICATION_INFO_PROTOCOL.
  488. @param[in] ControllerHandle Handle to the Controller.
  489. @param[in] Buffer Pointer to the authentication information.
  490. @retval EFI_UNSUPPORTED If the platform policies do not allow setting of
  491. the authentication information.
  492. **/
  493. EFI_STATUS
  494. EFIAPI
  495. IScsiSetAuthenticationInfo (
  496. IN EFI_AUTHENTICATION_INFO_PROTOCOL *This,
  497. IN EFI_HANDLE ControllerHandle,
  498. IN VOID *Buffer
  499. );
  500. //
  501. // EFI_EXT_SCSI_PASS_THRU_PROTOCOL for iSCSI driver.
  502. //
  503. /**
  504. Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel.
  505. This function supports both blocking I/O and nonblocking I/O. The blocking I/O
  506. functionality is required, and the nonblocking I/O functionality is optional.
  507. @param[in] This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
  508. @param[in] Target The Target is an array of size TARGET_MAX_BYTES and it
  509. represents the id of the SCSI device to send the SCSI
  510. Request Packet. Each transport driver may choose to
  511. utilize a subset of this size to suit the needs
  512. of transport target representation. For example, a
  513. Fibre Channel driver may use only 8 bytes (WWN)
  514. to represent an FC target.
  515. @param[in] Lun The LUN of the SCSI device to send the SCSI Request Packet.
  516. @param[in, out] Packet A pointer to the SCSI Request Packet to send to the
  517. SCSI device specified by Target and Lun.
  518. @param[in] Event If nonblocking I/O is not supported then Event is ignored,
  519. and blocking I/O is performed. If Event is NULL, then
  520. blocking I/O is performed. If Event is not NULL and non
  521. blocking I/O is supported, then nonblocking I/O is performed,
  522. and Event will be signaled when the SCSI Request Packet
  523. completes.
  524. @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For
  525. bi-directional commands, InTransferLength bytes
  526. were transferred from InDataBuffer.
  527. For write and bi-directional commands, OutTransferLength
  528. bytes were transferred by OutDataBuffer.
  529. @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was not executed.
  530. The number of bytes that could be transferred is
  531. returned in InTransferLength. For write and
  532. bi-directional commands, OutTransferLength bytes
  533. were transferred by OutDataBuffer.
  534. @retval EFI_NOT_READY The SCSI Request Packet could not be sent because
  535. there are too many SCSI Request Packets already
  536. queued. The caller may retry later.
  537. @retval EFI_DEVICE_ERROR A device error occurred while attempting to send
  538. the SCSI Request Packet.
  539. @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket
  540. are invalid.
  541. @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
  542. is not supported by the host adapter.
  543. This includes the case of Bi-directional SCSI
  544. commands not supported by the implementation.
  545. The SCSI Request Packet was not sent,
  546. so no additional status information is available.
  547. @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI
  548. Request Packet to execute.
  549. **/
  550. EFI_STATUS
  551. EFIAPI
  552. IScsiExtScsiPassThruFunction (
  553. IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
  554. IN UINT8 *Target,
  555. IN UINT64 Lun,
  556. IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
  557. IN EFI_EVENT Event OPTIONAL
  558. );
  559. /**
  560. Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on
  561. a SCSI channel. These can either be the list SCSI devices that are actually
  562. present on the SCSI channel, or the list of legal Target Ids and LUNs for the
  563. SCSI channel. Regardless, the caller of this function must probe the Target ID
  564. and LUN returned to see if a SCSI device is actually present at that location
  565. on the SCSI channel.
  566. @param[in] This The EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
  567. @param[in, out] Target On input, a pointer to the Target ID of a SCSI
  568. device present on the SCSI channel. On output, a
  569. pointer to the Target ID of the next SCSI device
  570. present on a SCSI channel. An input value of
  571. 0xFFFFFFFF retrieves the Target ID of the first
  572. SCSI device present on a SCSI channel.
  573. @param[in, out] Lun On input, a pointer to the LUN of a SCSI device
  574. present on the SCSI channel. On output, a pointer
  575. to the LUN of the next SCSI device present on a
  576. SCSI channel.
  577. @retval EFI_SUCCESS The Target ID and Lun of the next SCSI device on
  578. the SCSI channel was returned in Target and Lun.
  579. @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI
  580. channel.
  581. @retval EFI_INVALID_PARAMETER Target is not 0xFFFFFFFF,and Target and Lun were
  582. not returned on a previous call to
  583. GetNextDevice().
  584. **/
  585. EFI_STATUS
  586. EFIAPI
  587. IScsiExtScsiPassThruGetNextTargetLun (
  588. IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
  589. IN OUT UINT8 **Target,
  590. IN OUT UINT64 *Lun
  591. );
  592. /**
  593. Allocate and build a device path node for a SCSI device on a SCSI channel.
  594. @param[in] This Protocol instance pointer.
  595. @param[in] Target The Target ID of the SCSI device for which a
  596. device path node is to be allocated and built.
  597. @param[in] Lun The LUN of the SCSI device for which a device
  598. path node is to be allocated and built.
  599. @param[in, out] DevicePath A pointer to a single device path node that
  600. describes the SCSI device specified by Target and
  601. Lun. This function is responsible for allocating
  602. the buffer DevicePath with the boot service
  603. AllocatePool(). It is the caller's
  604. responsibility to free DevicePath when the caller
  605. is finished with DevicePath.
  606. @retval EFI_SUCCESS The device path node that describes the SCSI
  607. device specified by Target and Lun was allocated
  608. and returned in DevicePath.
  609. @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does
  610. not exist on the SCSI channel.
  611. @retval EFI_INVALID_PARAMETER DevicePath is NULL.
  612. @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate
  613. DevicePath.
  614. **/
  615. EFI_STATUS
  616. EFIAPI
  617. IScsiExtScsiPassThruBuildDevicePath (
  618. IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
  619. IN UINT8 *Target,
  620. IN UINT64 Lun,
  621. IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
  622. );
  623. /**
  624. Translate a device path node to a Target ID and LUN.
  625. @param[in] This Protocol instance pointer.
  626. @param[in] DevicePath A pointer to the device path node that describes
  627. a SCSI device on the SCSI channel.
  628. @param[out] Target A pointer to the Target ID of a SCSI device on
  629. the SCSI channel.
  630. @param[out] Lun A pointer to the LUN of a SCSI device on the SCSI
  631. channel.
  632. @retval EFI_SUCCESS DevicePath was successfully translated to a
  633. Target ID and LUN, and they were returned in
  634. Target and Lun.
  635. @retval EFI_INVALID_PARAMETER DevicePath/Target/Lun is NULL.
  636. @retval EFI_UNSUPPORTED This driver does not support the device path node
  637. type in DevicePath.
  638. @retval EFI_NOT_FOUND A valid translation from DevicePath to a Target
  639. ID and LUN does not exist.
  640. **/
  641. EFI_STATUS
  642. EFIAPI
  643. IScsiExtScsiPassThruGetTargetLun (
  644. IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
  645. IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
  646. OUT UINT8 **Target,
  647. OUT UINT64 *Lun
  648. );
  649. /**
  650. Resets a SCSI channel.This operation resets all the SCSI devices connected to
  651. the SCSI channel.
  652. @param[in] This Protocol instance pointer.
  653. @retval EFI_UNSUPPORTED It is not supported.
  654. **/
  655. EFI_STATUS
  656. EFIAPI
  657. IScsiExtScsiPassThruResetChannel (
  658. IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
  659. );
  660. /**
  661. Resets a SCSI device that is connected to a SCSI channel.
  662. @param[in] This Protocol instance pointer.
  663. @param[in] Target The Target ID of the SCSI device to reset.
  664. @param[in] Lun The LUN of the SCSI device to reset.
  665. @retval EFI_UNSUPPORTED It is not supported.
  666. **/
  667. EFI_STATUS
  668. EFIAPI
  669. IScsiExtScsiPassThruResetTargetLun (
  670. IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
  671. IN UINT8 *Target,
  672. IN UINT64 Lun
  673. );
  674. /**
  675. Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel.
  676. @param[in] This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL
  677. instance.
  678. @param[in, out] Target (TARGET_MAX_BYTES) of a SCSI device present on
  679. the SCSI channel. On output, a pointer to the
  680. Target ID (an array of TARGET_MAX_BYTES) of the
  681. next SCSI device present on a SCSI channel.
  682. An input value of 0xF(all bytes in the array are 0xF)
  683. in the Target array retrieves the Target ID of the
  684. first SCSI device present on a SCSI channel.
  685. @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI
  686. channel was returned in Target.
  687. @retval EFI_INVALID_PARAMETER Target or Lun is NULL.
  688. @retval EFI_TIMEOUT Target array is not all 0xF, and Target was not
  689. returned on a previous call to GetNextTarget().
  690. @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.
  691. **/
  692. EFI_STATUS
  693. EFIAPI
  694. IScsiExtScsiPassThruGetNextTarget (
  695. IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
  696. IN OUT UINT8 **Target
  697. );
  698. #endif