]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/ScsiPassThru.h
Fix doxygen issue:
[mirror_edk2.git] / MdePkg / Include / Protocol / ScsiPassThru.h
1 /** @file
2 SCSI Pass Through protocol.
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef __SCSI_PASS_THROUGH_H__
16 #define __SCSI_PASS_THROUGH_H__
17
18 #define EFI_SCSI_PASS_THRU_PROTOCOL_GUID \
19 { \
20 0xa59e8fcf, 0xbda0, 0x43bb, {0x90, 0xb1, 0xd3, 0x73, 0x2e, 0xca, 0xa8, 0x77 } \
21 }
22
23 //
24 // Forward reference for pure ANSI compatability
25 //
26 typedef struct _EFI_SCSI_PASS_THRU_PROTOCOL EFI_SCSI_PASS_THRU_PROTOCOL;
27
28 #define EFI_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL 0x0001
29 #define EFI_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL 0x0002
30 #define EFI_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004
31
32 //
33 // SCSI Host Adapter Status definition
34 //
35 #define EFI_SCSI_STATUS_HOST_ADAPTER_OK 0x00
36 #define EFI_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09 // timeout when processing the command
37 #define EFI_SCSI_STATUS_HOST_ADAPTER_TIMEOUT 0x0b // timeout when waiting for the command processing
38 #define EFI_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d // a message reject was received when processing command
39 #define EFI_SCSI_STATUS_HOST_ADAPTER_BUS_RESET 0x0e // a bus reset was detected
40 #define EFI_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f
41 #define EFI_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10 // the adapter failed in issuing request sense command
42 #define EFI_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11 // selection timeout
43 #define EFI_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12 // data overrun or data underrun
44 #define EFI_SCSI_STATUS_HOST_ADAPTER_BUS_FREE 0x13 // Unexepected bus free
45 #define EFI_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14 // Target bus phase sequence failure
46 #define EFI_SCSI_STATUS_HOST_ADAPTER_OTHER 0x7f
47
48 //
49 // SCSI Target Status definition
50 //
51 #define EFI_SCSI_STATUS_TARGET_GOOD 0x00
52 #define EFI_SCSI_STATUS_TARGET_CHECK_CONDITION 0x02 // check condition
53 #define EFI_SCSI_STATUS_TARGET_CONDITION_MET 0x04 // condition met
54 #define EFI_SCSI_STATUS_TARGET_BUSY 0x08 // busy
55 #define EFI_SCSI_STATUS_TARGET_INTERMEDIATE 0x10 // intermediate
56 #define EFI_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14 // intermediate-condition met
57 #define EFI_SCSI_STATUS_TARGET_RESERVATION_CONFLICT 0x18 // reservation conflict
58 #define EFI_SCSI_STATUS_TARGET_COMMOND_TERMINATED 0x22 // command terminated
59 #define EFI_SCSI_STATUS_TARGET_QUEUE_FULL 0x28 // queue full
60
61 typedef struct {
62 UINT64 Timeout;
63 VOID *DataBuffer;
64 VOID *SenseData;
65 VOID *Cdb;
66 UINT32 TransferLength;
67 UINT8 CdbLength;
68 UINT8 DataDirection;
69 UINT8 HostAdapterStatus;
70 UINT8 TargetStatus;
71 UINT8 SenseDataLength;
72 } EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;
73
74 typedef struct {
75 CHAR16 *ControllerName;
76 CHAR16 *ChannelName;
77 UINT32 AdapterId;
78 UINT32 Attributes;
79 UINT32 IoAlign;
80 } EFI_SCSI_PASS_THRU_MODE;
81
82 /**
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
88 @param This Protocol instance pointer.
89 @param Target The Target ID of the SCSI device to
90 send the SCSI Request Packet.
91 @param Lun The LUN of the SCSI device to send the
92 SCSI Request Packet.
93 @param Packet A pointer to the SCSI Request Packet to send
94 to the SCSI device specified by Target and Lun.
95 @param 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
103 @retval EFI_SUCCESS The 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 @retval EFI_BAD_BUFFER_SIZE 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 @retval 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 @retval 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 @retval 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 @retval 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 @retval 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_PASSTHRU)(
137 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
138 IN UINT32 Target,
139 IN UINT64 Lun,
140 IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
141 IN EFI_EVENT Event OPTIONAL
142 )
143 ;
144
145 /**
146 Used to retrieve the list of legal Target IDs for SCSI devices
147 on a SCSI channel.
148
149 @param This Protocol instance pointer.
150 @param Target On input, a pointer to the Target ID of a
151 SCSI device present on the SCSI channel.
152 On output, a pointer to the Target ID of
153 the next SCSI device present on a SCSI channel.
154 An input value of 0xFFFFFFFF retrieves the
155 Target ID of the first SCSI device present on
156 a SCSI channel.
157 @param Lun On input, a pointer to the LUN of a SCSI device
158 present on the SCSI channel.On output, a pointer
159 to the LUN of the next SCSI device present on a
160 SCSI channel.
161
162 @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI
163 channel was returned in Target and Lun.
164 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.
165 @retval EFI_INVALID_PARAMETER Target is not 0xFFFFFFFF, and Target and Lun were
166 not returned on a previous call to GetNextDevice().
167
168 **/
169 typedef
170 EFI_STATUS
171 (EFIAPI *EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE)(
172 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
173 IN OUT UINT32 *Target,
174 IN OUT UINT64 *Lun
175 )
176 ;
177
178 /**
179 Used to allocate and build a device path node for a SCSI device
180 on a SCSI channel.
181
182 @param This Protocol instance pointer.
183 @param Target The Target ID of the SCSI device for which
184 a device path node is to be allocated and built.
185 @param Lun The LUN of the SCSI device for which a device
186 path node is to be allocated and built.
187 @param DevicePath A pointer to a single device path node that
188 describes the SCSI device specified by
189 Target and Lun. This function is responsible
190 for allocating the buffer DevicePath with the boot
191 service AllocatePool(). It is the caller's
192 responsibility to free DevicePath when the caller
193 is finished with DevicePath.
194
195 @retval EFI_SUCCESS The device path node that describes the SCSI device
196 specified by Target and Lun was allocated and
197 returned in DevicePath.
198 @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does
199 not exist on the SCSI channel.
200 @retval EFI_INVALID_PARAMETER DevicePath is NULL.
201 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate
202 DevicePath.
203
204 **/
205 typedef
206 EFI_STATUS
207 (EFIAPI *EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH)(
208 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
209 IN UINT32 Target,
210 IN UINT64 Lun,
211 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
212 )
213 ;
214
215 /**
216 Used to translate a device path node to a Target ID and LUN.
217
218 @param This Protocol instance pointer.
219 @param DevicePath A pointer to the device path node that
220 describes a SCSI device on the SCSI channel.
221 @param Target A pointer to the Target ID of a SCSI device
222 on the SCSI channel.
223 @param Lun A pointer to the LUN of a SCSI device on
224 the SCSI channel.
225
226 @retval EFI_SUCCESS DevicePath was successfully translated to a
227 Target ID and LUN, and they were returned
228 in Target and Lun.
229 @retval EFI_INVALID_PARAMETER DevicePath is NULL.
230 @retval EFI_INVALID_PARAMETER Target is NULL.
231 @retval EFI_INVALID_PARAMETER Lun is NULL.
232 @retval EFI_UNSUPPORTED This driver does not support the device path
233 node type in DevicePath.
234 @retval EFI_NOT_FOUND A valid translation from DevicePath to a
235 Target ID and LUN does not exist.
236
237 **/
238 typedef
239 EFI_STATUS
240 (EFIAPI *EFI_SCSI_PASS_THRU_GET_TARGET_LUN)(
241 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
242 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
243 OUT UINT32 *Target,
244 OUT UINT64 *Lun
245 )
246 ;
247
248 /**
249 Resets a SCSI channel.This operation resets all the
250 SCSI devices connected to the SCSI channel.
251
252 @param This Protocol instance pointer.
253
254 @retval EFI_SUCCESS The SCSI channel was reset.
255 @retval EFI_UNSUPPORTED The SCSI channel does not support
256 a channel reset operation.
257 @retval EFI_DEVICE_ERROR A device error occurred while
258 attempting to reset the SCSI channel.
259 @retval EFI_TIMEOUT A timeout occurred while attempting
260 to reset the SCSI channel.
261
262 **/
263 typedef
264 EFI_STATUS
265 (EFIAPI *EFI_SCSI_PASS_THRU_RESET_CHANNEL)(
266 IN EFI_SCSI_PASS_THRU_PROTOCOL *This
267 )
268 ;
269
270 /**
271 Resets a SCSI device that is connected to a SCSI channel.
272
273 @param This Protocol instance pointer.
274 @param Target The Target ID of the SCSI device to reset.
275 @param Lun The LUN of the SCSI device to reset.
276
277 @retval EFI_SUCCESS The SCSI device specified by Target and
278 Lun was reset.
279 @retval EFI_UNSUPPORTED The SCSI channel does not support a target
280 reset operation.
281 @retval EFI_INVALID_PARAMETER Target or Lun are invalid.
282 @retval EFI_DEVICE_ERROR A device error occurred while attempting
283 to reset the SCSI device specified by Target
284 and Lun.
285 @retval EFI_TIMEOUT A timeout occurred while attempting to reset
286 the SCSI device specified by Target and Lun.
287
288 **/
289 typedef
290 EFI_STATUS
291 (EFIAPI *EFI_SCSI_PASS_THRU_RESET_TARGET)(
292 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
293 IN UINT32 Target,
294 IN UINT64 Lun
295 )
296 ;
297
298 struct _EFI_SCSI_PASS_THRU_PROTOCOL {
299 EFI_SCSI_PASS_THRU_MODE *Mode;
300 EFI_SCSI_PASS_THRU_PASSTHRU PassThru;
301 EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE GetNextDevice;
302 EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;
303 EFI_SCSI_PASS_THRU_GET_TARGET_LUN GetTargetLun;
304 EFI_SCSI_PASS_THRU_RESET_CHANNEL ResetChannel;
305 EFI_SCSI_PASS_THRU_RESET_TARGET ResetTarget;
306 };
307
308 extern EFI_GUID gEfiScsiPassThruProtocolGuid;
309
310 #endif