PageRenderTime 39ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/WindSLIC_EFI/include/efiScsiPassThru.h

https://github.com/untermensch/WindSLIC
C Header | 333 lines | 109 code | 18 blank | 206 comment | 0 complexity | ed9d2911dc4cd1bff6a950af63c238fb MD5 | raw file
  1. /*++
  2. Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
  3. This software and associated documentation (if any) is furnished
  4. under a license and may only be used or copied in accordance
  5. with the terms of the license. Except as permitted by such
  6. license, no part of this software or documentation may be
  7. reproduced, stored in a retrieval system, or transmitted in any
  8. form or by any means without the express written consent of
  9. Intel Corporation.
  10. Module Name:
  11. ScsiPassThru.h
  12. Abstract:
  13. SCSI Pass Through protocol.
  14. --*/
  15. #ifndef __SCSI_PT_H__
  16. #define __SCSI_PT_H__
  17. #define EFI_SCSI_PASS_THRU_PROTOCOL_GUID \
  18. { 0xa59e8fcf, 0xbda0, 0x43bb, 0x90, 0xb1, 0xd3, 0x73, 0x2e, 0xca, 0xa8, 0x77 }
  19. //
  20. // Forward reference for pure ANSI compatability
  21. //
  22. EFI_INTERFACE_DECL(_EFI_SCSI_PASS_THRU_PROTOCOL);
  23. #define EFI_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL 0x0001
  24. #define EFI_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL 0x0002
  25. #define EFI_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004
  26. //
  27. // SCSI Host Adapter Status definition
  28. //
  29. #define EFI_SCSI_STATUS_HOST_ADAPTER_OK 0x00
  30. #define EFI_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09 // timeout when processing the command
  31. #define EFI_SCSI_STATUS_HOST_ADAPTER_TIMEOUT 0x0b // timeout when waiting for the command processing
  32. #define EFI_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d // a message reject was received when processing command
  33. #define EFI_SCSI_STATUS_HOST_ADAPTER_BUS_RESET 0x0e // a bus reset was detected
  34. #define EFI_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f
  35. #define EFI_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10 // the adapter failed in issuing request sense command
  36. #define EFI_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11 // selection timeout
  37. #define EFI_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12 // data overrun or data underrun
  38. #define EFI_SCSI_STATUS_HOST_ADAPTER_BUS_FREE 0x13 // Unexepected bus free
  39. #define EFI_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14 // Target bus phase sequence failure
  40. #define EFI_SCSI_STATUS_HOST_ADAPTER_OTHER 0x7f
  41. //
  42. // SCSI Target Status definition
  43. //
  44. #define EFI_SCSI_STATUS_TARGET_GOOD 0x00
  45. #define EFI_SCSI_STATUS_TARGET_CHECK_CONDITION 0x02 // check condition
  46. #define EFI_SCSI_STATUS_TARGET_CONDITION_MET 0x04 // condition met
  47. #define EFI_SCSI_STATUS_TARGET_BUSY 0x08 // busy
  48. #define EFI_SCSI_STATUS_TARGET_INTERMEDIATE 0x10 // intermediate
  49. #define EFI_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14 // intermediate-condition met
  50. #define EFI_SCSI_STATUS_TARGET_RESERVATION_CONFLICT 0x18 // reservation conflict
  51. #define EFI_SCSI_STATUS_TARGET_COMMAND_TERMINATED 0x22 // command terminated
  52. #define EFI_SCSI_STATUS_TARGET_QUEUE_FULL 0x28 // queue full
  53. typedef struct {
  54. UINT64 Timeout;
  55. VOID *DataBuffer;
  56. VOID *SenseData;
  57. VOID *Cdb;
  58. UINT32 TransferLength;
  59. UINT8 CdbLength;
  60. UINT8 DataDirection;
  61. UINT8 HostAdapterStatus;
  62. UINT8 TargetStatus;
  63. UINT8 SenseDataLength;
  64. } EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;
  65. typedef struct {
  66. CHAR16 *ControllerName;
  67. CHAR16 *ChannelName;
  68. UINT32 AdapterId;
  69. UINT32 Attributes;
  70. UINT32 IoAlign;
  71. } EFI_SCSI_PASS_THRU_MODE;
  72. typedef
  73. EFI_STATUS
  74. (EFIAPI *EFI_SCSI_PASS_THRU_PASSTHRU) (
  75. IN struct _EFI_SCSI_PASS_THRU_PROTOCOL *This,
  76. IN UINT32 Target,
  77. IN UINT64 Lun,
  78. IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
  79. IN EFI_EVENT Event OPTIONAL
  80. )
  81. /*++
  82. Routine Description:
  83. Sends a SCSI Request Packet to a SCSI device that is attached to
  84. the SCSI channel. This function supports both blocking I/O and
  85. non-blocking I/O. The blocking I/O functionality is required,
  86. and the non-blocking I/O functionality is optional.
  87. Arguments:
  88. This - Protocol instance pointer.
  89. Target - The Target ID of the SCSI device to
  90. send the SCSI Request Packet.
  91. Lun - The LUN of the SCSI device to send the
  92. SCSI Request Packet.
  93. Packet - A pointer to the SCSI Request Packet to send
  94. to the SCSI device specified by Target and Lun.
  95. Event - If non-blocking I/O is not supported then Event
  96. is ignored, and blocking I/O is performed.
  97. If Event is NULL, then blocking I/O is performed.
  98. If Event is not NULL and non blocking I/O is
  99. supported, then non-blocking I/O is performed,
  100. and Event will be signaled when the SCSI Request
  101. Packet completes
  102. Returns:
  103. EFI_SUCCESSThe - SCSI Request Packet was sent by the host, and
  104. TransferLength bytes were transferred to/from
  105. DataBuffer.See HostAdapterStatus, TargetStatus,
  106. SenseDataLength,and SenseData in that order
  107. for additional status information.
  108. EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed, but the
  109. entire DataBuffer could not be transferred.
  110. The actual number of bytes transferred is returned
  111. in TransferLength. See HostAdapterStatus,
  112. TargetStatus, SenseDataLength, and SenseData in
  113. that order for additional status information.
  114. EFI_NOT_READY - The SCSI Request Packet could not be sent because
  115. there are too many SCSI Request Packets already
  116. queued. The caller may retry again later.
  117. EFI_DEVICE_ERROR - A device error occurred while attempting to send
  118. the SCSI Request Packet. See HostAdapterStatus,
  119. TargetStatus, SenseDataLength, and SenseData in
  120. that order for additional status information.
  121. EFI_INVALID_PARAMETER - Target, Lun, or the contents of ScsiRequestPacket
  122. are invalid. The SCSI Request Packet was not sent,
  123. so no additional status information is available.
  124. EFI_UNSUPPORTED - The command described by the SCSI Request Packet
  125. is not supported by the host adapter. The SCSI
  126. Request Packet was not sent, so no additional
  127. status information is available.
  128. EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
  129. Request Packet to execute. See HostAdapterStatus,
  130. TargetStatus, SenseDataLength, and SenseData in
  131. that order for additional status information.
  132. --*/
  133. ;
  134. typedef
  135. EFI_STATUS
  136. (EFIAPI *EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE) (
  137. IN struct _EFI_SCSI_PASS_THRU_PROTOCOL *This,
  138. IN OUT UINT32 *Target,
  139. IN OUT UINT64 *Lun
  140. )
  141. /*++
  142. Routine Description:
  143. Used to retrieve the list of legal Target IDs for SCSI devices
  144. on a SCSI channel.
  145. Arguments:
  146. This - Protocol instance pointer.
  147. Target - On input, a pointer to the Target ID of a
  148. SCSI device present on the SCSI channel.
  149. On output, a pointer to the Target ID of
  150. the next SCSI device present on a SCSI channel.
  151. An input value of 0xFFFFFFFF retrieves the
  152. Target ID of the first SCSI device present on
  153. a SCSI channel.
  154. Lun - On input, a pointer to the LUN of a SCSI device
  155. present on the SCSI channel.On output, a pointer
  156. to the LUN of the next SCSI device present on a
  157. SCSI channel.
  158. Returns:
  159. EFI_SUCCESS - The Target ID of the next SCSI device on the SCSI
  160. channel was returned in Target and Lun.
  161. EFI_NOT_FOUND - There are no more SCSI devices on this SCSI channel.
  162. EFI_INVALID_PARAMETER - Target is not 0xFFFFFFFF, and Target and Lun were
  163. not returned on a previous call to GetNextDevice().
  164. --*/
  165. ;
  166. typedef
  167. EFI_STATUS
  168. (EFIAPI *EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH) (
  169. IN struct _EFI_SCSI_PASS_THRU_PROTOCOL *This,
  170. IN UINT32 Target,
  171. IN UINT64 Lun,
  172. IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
  173. )
  174. /*++
  175. Routine Description:
  176. Used to allocate and build a device path node for a SCSI device
  177. on a SCSI channel.
  178. Arguments:
  179. This - Protocol instance pointer.
  180. Target - The Target ID of the SCSI device for which
  181. a device path node is to be allocated and built.
  182. Lun - The LUN of the SCSI device for which a device
  183. path node is to be allocated and built.
  184. DevicePath - A pointer to a single device path node that
  185. describes the SCSI device specified by
  186. Target and Lun. This function is responsible
  187. for allocating the buffer DevicePath with the boot
  188. service AllocatePool(). It is the caller's
  189. responsibility to free DevicePath when the caller
  190. is finished with DevicePath.
  191. Returns:
  192. EFI_SUCCESS - The device path node that describes the SCSI device
  193. specified by Target and Lun was allocated and
  194. returned in DevicePath.
  195. EFI_NOT_FOUND - The SCSI devices specified by Target and Lun does
  196. not exist on the SCSI channel.
  197. EFI_INVALID_PARAMETER - DevicePath is NULL.
  198. EFI_OUT_OF_RESOURCES - There are not enough resources to allocate
  199. DevicePath.
  200. --*/
  201. ;
  202. typedef
  203. EFI_STATUS
  204. (EFIAPI *EFI_SCSI_PASS_THRU_GET_TARGET_LUN) (
  205. IN struct _EFI_SCSI_PASS_THRU_PROTOCOL *This,
  206. IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
  207. OUT UINT32 *Target,
  208. OUT UINT64 *Lun
  209. )
  210. /*++
  211. Routine Description:
  212. Used to translate a device path node to a Target ID and LUN.
  213. Arguments:
  214. This - Protocol instance pointer.
  215. DevicePath - A pointer to the device path node that
  216. describes a SCSI device on the SCSI channel.
  217. Target - A pointer to the Target ID of a SCSI device
  218. on the SCSI channel.
  219. Lun - A pointer to the LUN of a SCSI device on
  220. the SCSI channel.
  221. Returns:
  222. EFI_SUCCESS - DevicePath was successfully translated to a
  223. Target ID and LUN, and they were returned
  224. in Target and Lun.
  225. EFI_INVALID_PARAMETER - DevicePath is NULL.
  226. EFI_INVALID_PARAMETER - Target is NULL.
  227. EFI_INVALID_PARAMETER - Lun is NULL.
  228. EFI_UNSUPPORTED - This driver does not support the device path
  229. node type in DevicePath.
  230. EFI_NOT_FOUND - A valid translation from DevicePath to a
  231. Target ID and LUN does not exist.
  232. --*/
  233. ;
  234. typedef
  235. EFI_STATUS
  236. (EFIAPI *EFI_SCSI_PASS_THRU_RESET_CHANNEL) (
  237. IN struct _EFI_SCSI_PASS_THRU_PROTOCOL *This
  238. )
  239. /*++
  240. Routine Description:
  241. Resets a SCSI channel.This operation resets all the
  242. SCSI devices connected to the SCSI channel.
  243. Arguments:
  244. This - Protocol instance pointer.
  245. Returns:
  246. EFI_SUCCESS - The SCSI channel was reset.
  247. EFI_UNSUPPORTED - The SCSI channel does not support
  248. a channel reset operation.
  249. EFI_DEVICE_ERROR - A device error occurred while
  250. attempting to reset the SCSI channel.
  251. EFI_TIMEOUT - A timeout occurred while attempting
  252. to reset the SCSI channel.
  253. --*/
  254. ;
  255. typedef
  256. EFI_STATUS
  257. (EFIAPI *EFI_SCSI_PASS_THRU_RESET_TARGET) (
  258. IN struct _EFI_SCSI_PASS_THRU_PROTOCOL *This,
  259. IN UINT32 Target,
  260. IN UINT64 Lun
  261. )
  262. /*++
  263. Routine Description:
  264. Resets a SCSI device that is connected to a SCSI channel.
  265. Arguments:
  266. This - Protocol instance pointer.
  267. Target - The Target ID of the SCSI device to reset.
  268. Lun - The LUN of the SCSI device to reset.
  269. Returns:
  270. EFI_SUCCESS - The SCSI device specified by Target and
  271. Lun was reset.
  272. EFI_UNSUPPORTED - The SCSI channel does not support a target
  273. reset operation.
  274. EFI_INVALID_PARAMETER - Target or Lun are invalid.
  275. EFI_DEVICE_ERROR - A device error occurred while attempting
  276. to reset the SCSI device specified by Target
  277. and Lun.
  278. EFI_TIMEOUT - A timeout occurred while attempting to reset
  279. the SCSI device specified by Target and Lun.
  280. --*/
  281. ;
  282. typedef struct _EFI_SCSI_PASS_THRU_PROTOCOL {
  283. EFI_SCSI_PASS_THRU_MODE *Mode;
  284. EFI_SCSI_PASS_THRU_PASSTHRU PassThru;
  285. EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE GetNextDevice;
  286. EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;
  287. EFI_SCSI_PASS_THRU_GET_TARGET_LUN GetTargetLun;
  288. EFI_SCSI_PASS_THRU_RESET_CHANNEL ResetChannel;
  289. EFI_SCSI_PASS_THRU_RESET_TARGET ResetTarget;
  290. } EFI_SCSI_PASS_THRU_PROTOCOL;
  291. extern EFI_GUID ScsiPassThruProtocol;
  292. #endif