]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/ScsiIo.h
the 1st paramter of the function prototype lost the "CONST" keyword which is not...
[mirror_edk2.git] / MdePkg / Include / Protocol / ScsiIo.h
... / ...
CommitLineData
1/** @file\r
2 EFI_SCSI_IO_PROTOCOL as defined in UEFI 2.0.\r
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
6\r
7 Copyright (c) 2006 - 2008, Intel Corporation \r
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
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
23 0x932f47e6, 0x2362, 0x4002, {0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \\r
24 }\r
25\r
26///\r
27/// Forward reference for pure ANSI compatability\r
28///\r
29typedef 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
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
46#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f\r
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
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
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
67\r
68typedef struct {\r
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
77 UINT64 Timeout;\r
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
82 VOID *InDataBuffer;\r
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
87 VOID *OutDataBuffer;\r
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
92 VOID *SenseData;\r
93 ///\r
94 /// A pointer to buffer that contains the Command Data Block to\r
95 /// send to the SCSI device.\r
96 ///\r
97 VOID *Cdb;\r
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
102 UINT32 InTransferLength;\r
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
107 UINT32 OutTransferLength;\r
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
112 UINT8 CdbLength;\r
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
117 UINT8 DataDirection;\r
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
123 UINT8 HostAdapterStatus;\r
124 ///\r
125 /// The status returned by the SCSI device when the SCSI Request\r
126 /// Packet was executed.\r
127 ///\r
128 UINT8 TargetStatus;\r
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
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
143 @retval EFI_SUCCESS Retrieved the device type information successfully.\r
144 @retval EFI_INVALID_PARAMETER The DeviceType is NULL.\r
145\r
146**/\r
147typedef\r
148EFI_STATUS\r
149(EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE)(\r
150 IN EFI_SCSI_IO_PROTOCOL *This,\r
151 OUT UINT8 *DeviceType\r
152 );\r
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
167typedef\r
168EFI_STATUS\r
169(EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION)(\r
170 IN EFI_SCSI_IO_PROTOCOL *This,\r
171 IN OUT UINT8 **Target,\r
172 OUT UINT64 *Lun\r
173 );\r
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
188typedef\r
189EFI_STATUS\r
190(EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_BUS)(\r
191 IN EFI_SCSI_IO_PROTOCOL *This\r
192 );\r
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
200 @retval EFI_DEVICE_ERROR Errors were encountered when resetting the\r
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
208typedef\r
209EFI_STATUS\r
210(EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_DEVICE)(\r
211 IN EFI_SCSI_IO_PROTOCOL *This\r
212 );\r
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
221 @param Event If the SCSI bus to which the SCSI device is attached\r
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
232 transferred to/from DataBuffer. See\r
233 HostAdapterStatus, TargetStatus,\r
234 SenseDataLength, and SenseData in that order\r
235 for additional status information.\r
236 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed,\r
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
263typedef\r
264EFI_STATUS\r
265(EFIAPI *EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND)(\r
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
269 );\r
270\r
271///\r
272/// Provides services to manage and communicate with SCSI devices.\r
273///\r
274struct _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
279 EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND ExecuteScsiCommand; \r
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
287 UINT32 IoAlign;\r
288};\r
289\r
290extern EFI_GUID gEfiScsiIoProtocolGuid;\r
291\r
292#endif\r