]>
Commit | Line | Data |
---|---|---|
d1f95000 | 1 | /** @file\r |
2 | EFI_SCSI_IO_PROTOCOL as defined in UEFI 2.0.\r | |
4ca9b6c4 LG |
3 | This protocol is used by code, typically drivers, running in the EFI boot \r |
4 | services environment to access SCSI devices. In particular, functions for \r | |
5 | managing devices on SCSI buses are defined here.\r | |
d1f95000 | 6 | \r |
4ca9b6c4 | 7 | Copyright (c) 2006 - 2008, Intel Corporation \r |
d1f95000 | 8 | All rights reserved. This program and the accompanying materials \r |
9 | are licensed and made available under the terms and conditions of the BSD License \r | |
10 | which accompanies this distribution. The full text of the license may be found at \r | |
11 | http://opensource.org/licenses/bsd-license.php \r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
15 | \r | |
d1f95000 | 16 | **/\r |
17 | \r | |
18 | #ifndef __EFI_SCSI_IO_PROTOCOL_H__\r | |
19 | #define __EFI_SCSI_IO_PROTOCOL_H__\r | |
20 | \r | |
21 | #define EFI_SCSI_IO_PROTOCOL_GUID \\r | |
22 | { \\r | |
eecd469b | 23 | 0x932f47e6, 0x2362, 0x4002, {0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \\r |
d1f95000 | 24 | }\r |
25 | \r | |
99e8ed21 | 26 | ///\r |
27 | /// Forward reference for pure ANSI compatability\r | |
28 | ///\r | |
d1f95000 | 29 | typedef struct _EFI_SCSI_IO_PROTOCOL EFI_SCSI_IO_PROTOCOL;\r |
30 | \r | |
31 | //\r | |
32 | // SCSI Data Direction definition\r | |
33 | //\r | |
34 | #define EFI_SCSI_IO_DATA_DIRECTION_READ 0\r | |
35 | #define EFI_SCSI_IO_DATA_DIRECTION_WRITE 1\r | |
36 | #define EFI_SCSI_IO_DATA_DIRECTION_BIDIRECTIONAL 2\r | |
37 | \r | |
38 | //\r | |
39 | // SCSI Host Adapter Status definition\r | |
40 | //\r | |
41 | #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OK 0x00\r | |
992f22b9 LG |
42 | #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09 ///< timeout when processing the command\r |
43 | #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT 0x0b ///< timeout when waiting for the command processing\r | |
44 | #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d ///< a message reject was received when processing command\r | |
45 | #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_RESET 0x0e ///< a bus reset was detected\r | |
d1f95000 | 46 | #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f\r |
992f22b9 LG |
47 | #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10 ///< the adapter failed in issuing request sense command\r |
48 | #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11 ///< selection timeout\r | |
49 | #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12 ///< data overrun or data underrun\r | |
50 | #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_FREE 0x13 ///< Unexepected bus free\r | |
51 | #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14 ///< Target bus phase sequence failure\r | |
d1f95000 | 52 | #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OTHER 0x7f\r |
53 | \r | |
54 | \r | |
55 | //\r | |
56 | // SCSI Target Status definition\r | |
57 | //\r | |
58 | #define EFI_SCSI_IO_STATUS_TARGET_GOOD 0x00\r | |
992f22b9 LG |
59 | #define EFI_SCSI_IO_STATUS_TARGET_CHECK_CONDITION 0x02 ///< check condition\r |
60 | #define EFI_SCSI_IO_STATUS_TARGET_CONDITION_MET 0x04 ///< condition met\r | |
61 | #define EFI_SCSI_IO_STATUS_TARGET_BUSY 0x08 ///< busy\r | |
62 | #define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE 0x10 ///< intermediate\r | |
63 | #define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14 ///< intermediate-condition met\r | |
64 | #define EFI_SCSI_IO_STATUS_TARGET_RESERVATION_CONFLICT 0x18 ///< reservation conflict\r | |
65 | #define EFI_SCSI_IO_STATUS_TARGET_COMMOND_TERMINATED 0x22 ///< command terminated\r | |
66 | #define EFI_SCSI_IO_STATUS_TARGET_QUEUE_FULL 0x28 ///< queue full\r | |
d1f95000 | 67 | \r |
68 | typedef struct {\r | |
992f22b9 LG |
69 | ///\r |
70 | /// The timeout, in 100 ns units, to use for the execution of this SCSI\r | |
71 | /// Request Packet. A Timeout value of 0 means that this function\r | |
72 | /// will wait indefinitely for the SCSI Request Packet to execute. If\r | |
73 | /// Timeout is greater than zero, then this function will return\r | |
74 | /// EFI_TIMEOUT if the time required to execute the SCSI Request\r | |
75 | /// Packet is greater than Timeout.\r | |
76 | ///\r | |
d1f95000 | 77 | UINT64 Timeout;\r |
992f22b9 LG |
78 | ///\r |
79 | /// A pointer to the data buffer to transfer between the SCSI\r | |
80 | /// controller and the SCSI device for SCSI READ command\r | |
81 | ///\r | |
d1f95000 | 82 | VOID *InDataBuffer;\r |
992f22b9 LG |
83 | ///\r |
84 | /// A pointer to the data buffer to transfer between the SCSI\r | |
85 | /// controller and the SCSI device for SCSI WRITE command.\r | |
86 | ///\r | |
d1f95000 | 87 | VOID *OutDataBuffer;\r |
992f22b9 LG |
88 | ///\r |
89 | /// A pointer to the sense data that was generated by the execution of\r | |
90 | /// the SCSI Request Packet.\r | |
91 | ///\r | |
d1f95000 | 92 | VOID *SenseData;\r |
992f22b9 LG |
93 | ///\r |
94 | /// A pointer to buffer that contains the Command Data Block to\r | |
95 | /// send to the SCSI device.\r | |
96 | ///\r | |
d1f95000 | 97 | VOID *Cdb;\r |
992f22b9 LG |
98 | ///\r |
99 | /// On Input, the size, in bytes, of InDataBuffer. On output, the\r | |
100 | /// number of bytes transferred between the SCSI controller and the SCSI device.\r | |
101 | ///\r | |
d1f95000 | 102 | UINT32 InTransferLength;\r |
992f22b9 LG |
103 | ///\r |
104 | /// On Input, the size, in bytes of OutDataBuffer. On Output, the\r | |
105 | /// Number of bytes transferred between SCSI Controller and the SCSI device.\r | |
106 | ///\r | |
d1f95000 | 107 | UINT32 OutTransferLength;\r |
992f22b9 LG |
108 | ///\r |
109 | /// The length, in bytes, of the buffer Cdb. The standard values are\r | |
110 | /// 6, 10, 12, and 16, but other values are possible if a variable length CDB is used.\r | |
111 | ///\r | |
d1f95000 | 112 | UINT8 CdbLength;\r |
992f22b9 LG |
113 | ///\r |
114 | /// The direction of the data transfer. 0 for reads, 1 for writes. A\r | |
115 | /// value of 2 is Reserved for Bi-Directional SCSI commands.\r | |
116 | ///\r | |
d1f95000 | 117 | UINT8 DataDirection;\r |
992f22b9 LG |
118 | ///\r |
119 | /// The status of the SCSI Host Controller that produces the SCSI\r | |
120 | /// bus where the SCSI device attached when the SCSI Request\r | |
121 | /// Packet was executed on the SCSI Controller.\r | |
122 | ///\r | |
d1f95000 | 123 | UINT8 HostAdapterStatus;\r |
992f22b9 LG |
124 | ///\r |
125 | /// The status returned by the SCSI device when the SCSI Request\r | |
126 | /// Packet was executed.\r | |
127 | ///\r | |
d1f95000 | 128 | UINT8 TargetStatus;\r |
992f22b9 LG |
129 | ///\r |
130 | /// On input, the length in bytes of the SenseData buffer. On\r | |
131 | /// output, the number of bytes written to the SenseData buffer.\r | |
132 | ///\r | |
d1f95000 | 133 | UINT8 SenseDataLength;\r |
134 | } EFI_SCSI_IO_SCSI_REQUEST_PACKET;\r | |
135 | \r | |
136 | /**\r | |
137 | Retrieves the device type information of the SCSI Controller.\r | |
138 | \r | |
139 | @param This Protocol instance pointer.\r | |
140 | @param DeviceType A pointer to the device type information\r | |
141 | retrieved from the SCSI Controller.\r | |
142 | \r | |
630b4187 | 143 | @retval EFI_SUCCESS Retrieved the device type information successfully.\r |
d1f95000 | 144 | @retval EFI_INVALID_PARAMETER The DeviceType is NULL.\r |
145 | \r | |
146 | **/\r | |
147 | typedef\r | |
148 | EFI_STATUS\r | |
8b13229b | 149 | (EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE)(\r |
d1f95000 | 150 | IN EFI_SCSI_IO_PROTOCOL *This,\r |
151 | OUT UINT8 *DeviceType\r | |
ed66e1bc | 152 | );\r |
d1f95000 | 153 | \r |
154 | /**\r | |
155 | Retrieves the device location in the SCSI channel.\r | |
156 | \r | |
157 | @param This Protocol instance pointer.\r | |
158 | @param Target A pointer to the Target ID of a SCSI device\r | |
159 | on the SCSI channel.\r | |
160 | @param Lun A pointer to the LUN of the SCSI device on\r | |
161 | the SCSI channel.\r | |
162 | \r | |
163 | @retval EFI_SUCCESS Retrieves the device location successfully.\r | |
164 | @retval EFI_INVALID_PARAMETER The Target or Lun is NULL.\r | |
165 | \r | |
166 | **/\r | |
167 | typedef\r | |
168 | EFI_STATUS\r | |
8b13229b | 169 | (EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION)(\r |
d1f95000 | 170 | IN EFI_SCSI_IO_PROTOCOL *This,\r |
171 | IN OUT UINT8 **Target,\r | |
172 | OUT UINT64 *Lun\r | |
ed66e1bc | 173 | );\r |
d1f95000 | 174 | \r |
175 | /**\r | |
176 | Resets the SCSI Bus that the SCSI Controller is attached to.\r | |
177 | \r | |
178 | @param This Protocol instance pointer.\r | |
179 | \r | |
180 | @retval EFI_SUCCESS The SCSI bus is reset successfully.\r | |
181 | @retval EFI_DEVICE_ERROR Errors encountered when resetting the SCSI bus.\r | |
182 | @retval EFI_UNSUPPORTED The bus reset operation is not supported by the\r | |
183 | SCSI Host Controller.\r | |
184 | @retval EFI_TIMEOUT A timeout occurred while attempting to reset\r | |
185 | the SCSI bus.\r | |
186 | \r | |
187 | **/\r | |
188 | typedef\r | |
189 | EFI_STATUS\r | |
8b13229b | 190 | (EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_BUS)(\r |
d1f95000 | 191 | IN EFI_SCSI_IO_PROTOCOL *This\r |
ed66e1bc | 192 | );\r |
d1f95000 | 193 | \r |
194 | /**\r | |
195 | Resets the SCSI Controller that the device handle specifies.\r | |
196 | \r | |
197 | @param This Protocol instance pointer.\r | |
198 | \r | |
199 | @retval EFI_SUCCESS Reset the SCSI controller successfully.\r | |
630b4187 | 200 | @retval EFI_DEVICE_ERROR Errors were encountered when resetting the\r |
d1f95000 | 201 | SCSI Controller.\r |
202 | @retval EFI_UNSUPPORTED The SCSI bus does not support a device\r | |
203 | reset operation.\r | |
204 | @retval EFI_TIMEOUT A timeout occurred while attempting to\r | |
205 | reset the SCSI Controller.\r | |
206 | \r | |
207 | **/\r | |
208 | typedef\r | |
209 | EFI_STATUS\r | |
8b13229b | 210 | (EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_DEVICE)(\r |
d1f95000 | 211 | IN EFI_SCSI_IO_PROTOCOL *This\r |
ed66e1bc | 212 | );\r |
d1f95000 | 213 | \r |
214 | \r | |
215 | /**\r | |
216 | Sends a SCSI Request Packet to the SCSI Controller for execution.\r | |
217 | \r | |
218 | @param This Protocol instance pointer.\r | |
219 | @param Packet The SCSI request packet to send to the SCSI\r | |
220 | Controller specified by the device handle.\r | |
630b4187 | 221 | @param Event If the SCSI bus to which the SCSI device is attached\r |
d1f95000 | 222 | does not support non-blocking I/O, then Event is\r |
223 | ignored, and blocking I/O is performed.\r | |
224 | If Event is NULL, then blocking I/O is performed.\r | |
225 | If Event is not NULL and non-blocking I/O is\r | |
226 | supported, then non-blocking I/O is performed,\r | |
227 | and Event will be signaled when the SCSI Request\r | |
228 | Packet completes.\r | |
229 | \r | |
230 | @retval EFI_SUCCESS The SCSI Request Packet was sent by the host\r | |
231 | successfully, and TransferLength bytes were\r | |
630b4187 | 232 | transferred to/from DataBuffer. See\r |
d1f95000 | 233 | HostAdapterStatus, TargetStatus,\r |
234 | SenseDataLength, and SenseData in that order\r | |
235 | for additional status information.\r | |
c7a54f25 | 236 | @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed,\r |
d1f95000 | 237 | but the entire DataBuffer could not be transferred.\r |
238 | The actual number of bytes transferred is returned\r | |
239 | in TransferLength. See HostAdapterStatus,\r | |
240 | TargetStatus, SenseDataLength, and SenseData in\r | |
241 | that order for additional status information.\r | |
242 | @retval EFI_NOT_READY The SCSI Request Packet could not be sent because\r | |
243 | there are too many SCSI Command Packets already\r | |
244 | queued.The caller may retry again later.\r | |
245 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to send\r | |
246 | the SCSI Request Packet. See HostAdapterStatus,\r | |
247 | TargetStatus, SenseDataLength, and SenseData in\r | |
248 | that order for additional status information.\r | |
249 | @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid.\r | |
250 | The SCSI Request Packet was not sent, so no\r | |
251 | additional status information is available.\r | |
252 | @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r | |
253 | is not supported by the SCSI initiator(i.e., SCSI\r | |
254 | Host Controller). The SCSI Request Packet was not\r | |
255 | sent, so no additional status information is\r | |
256 | available.\r | |
257 | @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI\r | |
258 | Request Packet to execute. See HostAdapterStatus,\r | |
259 | TargetStatus, SenseDataLength, and SenseData in\r | |
260 | that order for additional status information.\r | |
261 | \r | |
262 | **/\r | |
263 | typedef\r | |
264 | EFI_STATUS\r | |
8b13229b | 265 | (EFIAPI *EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND)(\r |
d1f95000 | 266 | IN EFI_SCSI_IO_PROTOCOL *This,\r |
267 | IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet,\r | |
268 | IN EFI_EVENT Event OPTIONAL\r | |
ed66e1bc | 269 | );\r |
d1f95000 | 270 | \r |
44717a39 | 271 | ///\r |
272 | /// Provides services to manage and communicate with SCSI devices.\r | |
273 | ///\r | |
d1f95000 | 274 | struct _EFI_SCSI_IO_PROTOCOL {\r |
275 | EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE GetDeviceType;\r | |
276 | EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION GetDeviceLocation;\r | |
277 | EFI_SCSI_IO_PROTOCOL_RESET_BUS ResetBus;\r | |
278 | EFI_SCSI_IO_PROTOCOL_RESET_DEVICE ResetDevice;\r | |
a02e796b | 279 | EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND ExecuteScsiCommand; \r |
1f08a159 | 280 | \r |
281 | ///\r | |
282 | /// Supplies the alignment requirement for any buffer used in a data transfer. \r | |
283 | /// IoAlign values of 0 and 1 mean that the buffer can be placed anywhere in memory. \r | |
284 | /// Otherwise, IoAlign must be a power of 2, and the requirement is that the \r | |
285 | /// start address of a buffer must be evenly divisible by IoAlign with no remainder.\r | |
286 | ///\r | |
d1f95000 | 287 | UINT32 IoAlign;\r |
288 | };\r | |
289 | \r | |
290 | extern EFI_GUID gEfiScsiIoProtocolGuid;\r | |
291 | \r | |
292 | #endif\r |