]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/ScsiPassThruExt.h
Remove BugBug in comments and adjust function header according to code style doc.
[mirror_edk2.git] / MdePkg / Include / Protocol / ScsiPassThruExt.h
1 /** @file
2 EFI_EXT_SCSI_PASS_THRU_PROTOCOL as defined in UEFI 2.0.
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 Module Name: ScsiPassThruExt.h
14
15 **/
16
17 #ifndef __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__
18 #define __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__
19
20 #define EFI_EXT_SCSI_PASS_THRU_PROTOCOL_GUID \
21 { \
22 0x1d3de7f0, 0x0807, 0x424f, {0xaa, 0x69, 0x11, 0xa5, 0x4e, 0x19, 0xa4, 0x6f } \
23 }
24
25 typedef struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL EFI_EXT_SCSI_PASS_THRU_PROTOCOL;
26
27 #define TARGET_MAX_BYTES 0x10
28
29 #define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL 0x0001
30 #define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL 0x0002
31 #define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004
32
33 //
34 // DataDirection
35 //
36 #define EFI_EXT_SCSI_DATA_DIRECTION_READ 0
37 #define EFI_EXT_SCSI_DATA_DIRECTION_WRITE 1
38 #define EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTIONAL 2
39 //
40 // HostAdapterStatus
41 //
42 #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK 0x00
43 #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09
44 #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT 0x0b
45 #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d
46 #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_RESET 0x0e
47 #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f
48 #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10
49 #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11
50 #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12
51 #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_FREE 0x13
52 #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14
53 #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER 0x7f
54 //
55 // TargetStatus
56 //
57 #define EFI_EXT_SCSI_STATUS_TARGET_GOOD 0x00
58 #define EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION 0x02
59 #define EFI_EXT_SCSI_STATUS_TARGET_CONDITION_MET 0x04
60 #define EFI_EXT_SCSI_STATUS_TARGET_BUSY 0x08
61 #define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE 0x10
62 #define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14
63 #define EFI_EXT_SCSI_STATUS_TARGET_RESERVATION_CONFLICT 0x18
64 #define EFI_EXT_SCSI_STATUS_TARGET_TASK_SET_FULL 0x28
65 #define EFI_EXT_SCSI_STATUS_TARGET_ACA_ACTIVE 0x30
66 #define EFI_EXT_SCSI_STATUS_TARGET_TASK_ABORTED 0x40
67
68 typedef struct {
69 UINT32 AdapterId;
70 UINT32 Attributes;
71 UINT32 IoAlign;
72 } EFI_EXT_SCSI_PASS_THRU_MODE;
73
74 typedef struct {
75 UINT64 Timeout;
76 VOID *InDataBuffer;
77 VOID *OutDataBuffer;
78 VOID *SenseData;
79 VOID *Cdb;
80 UINT32 InTransferLength;
81 UINT32 OutTransferLength;
82 UINT8 CdbLength;
83 UINT8 DataDirection;
84 UINT8 HostAdapterStatus;
85 UINT8 TargetStatus;
86 UINT8 SenseDataLength;
87 } EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;
88
89 /**
90 Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function
91 supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the
92 nonblocking I/O functionality is optional.
93
94 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
95 @param Target The Target is an array of size TARGET_MAX_BYTES and it represents
96 the id of the SCSI device to send the SCSI Request Packet. Each
97 transport driver may chose to utilize a subset of this size to suit the needs
98 of transport target representation. For example, a Fibre Channel driver
99 may use only 8 bytes (WWN) to represent an FC target.
100 @param Lun The LUN of the SCSI device to send the SCSI Request Packet.
101 @param Packet A pointer to the SCSI Request Packet to send to the SCSI device
102 specified by Target and Lun.
103 @param Event If nonblocking I/O is not supported then Event is ignored, and blocking
104 I/O is performed. If Event is NULL, then blocking I/O is performed. If
105 Event is not NULL and non blocking I/O is supported, then
106 nonblocking I/O is performed, and Event will be signaled when the
107 SCSI Request Packet completes.
108
109 @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For bi-directional
110 commands, InTransferLength bytes were transferred from
111 InDataBuffer. For write and bi-directional commands,
112 OutTransferLength bytes were transferred by
113 OutDataBuffer.
114 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was not executed. The number of bytes that
115 could be transferred is returned in InTransferLength. For write
116 and bi-directional commands, OutTransferLength bytes were
117 transferred by OutDataBuffer.
118 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many
119 SCSI Request Packets already queued. The caller may retry again later.
120 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request
121 Packet.
122 @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket are invalid.
123 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported
124 by the host adapter. This includes the case of Bi-directional SCSI
125 commands not supported by the implementation. The SCSI Request
126 Packet was not sent, so no additional status information is available.
127 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.
128
129 **/
130 typedef
131 EFI_STATUS
132 (EFIAPI *EFI_EXT_SCSI_PASS_THRU_PASSTHRU) (
133 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
134 IN UINT8 *Target,
135 IN UINT64 Lun,
136 IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
137 IN EFI_EVENT Event OPTIONAL
138 )
139 ;
140
141 /**
142 Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These
143 can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal
144 Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the
145 Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI
146 channel.
147
148 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
149 @param Target On input, a pointer to the Target ID (an array of size
150 TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.
151 On output, a pointer to the Target ID (an array of
152 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI
153 channel. An input value of 0xF(all bytes in the array are 0xF) in the
154 Target array retrieves the Target ID of the first SCSI device present on a
155 SCSI channel.
156 @param Lun On input, a pointer to the LUN of a SCSI device present on the SCSI
157 channel. On output, a pointer to the LUN of the next SCSI device present
158 on a SCSI channel.
159
160 @retval EFI_SUCCESS The Target ID and LUN of the next SCSI device on the SCSI
161 channel was returned in Target and Lun.
162 @retval EFI_INVALID_PARAMETER Target array is not all 0xF, and Target and Lun were
163 not returned on a previous call to GetNextTargetLun().
164 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.
165
166 **/
167 typedef
168 EFI_STATUS
169 (EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN) (
170 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
171 IN OUT UINT8 **Target,
172 IN OUT UINT64 *Lun
173 )
174 ;
175
176 /**
177 Used to allocate and build a device path node for a SCSI device on a SCSI channel.
178
179 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
180 @param Target The Target is an array of size TARGET_MAX_BYTES and it specifies the
181 Target ID of the SCSI device for which a device path node is to be
182 allocated and built. Transport drivers may chose to utilize a subset of
183 this size to suit the representation of targets. For example, a Fibre
184 Channel driver may use only 8 bytes (WWN) in the array to represent a
185 FC target.
186 @param Lun The LUN of the SCSI device for which a device path node is to be
187 allocated and built.
188 @param DevicePath A pointer to a single device path node that describes the SCSI device
189 specified by Target and Lun. This function is responsible for
190 allocating the buffer DevicePath with the boot service
191 AllocatePool(). It is the caller's responsibility to free
192 DevicePath when the caller is finished with DevicePath.
193
194 @retval EFI_SUCCESS The device path node that describes the SCSI device specified by
195 Target and Lun was allocated and returned in
196 DevicePath.
197 @retval EFI_INVALID_PARAMETER DevicePath is NULL.
198 @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does not exist
199 on the SCSI channel.
200 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.
201
202 **/
203 typedef
204 EFI_STATUS
205 (EFIAPI *EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH) (
206 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
207 IN UINT8 *Target,
208 IN UINT64 Lun,
209 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
210 )
211 ;
212
213 /**
214 Used to translate a device path node to a Target ID and LUN.
215
216 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
217 @param DevicePath A pointer to a single device path node that describes the SCSI device
218 on the SCSI channel.
219 @param Target A pointer to the Target Array which represents the ID of a SCSI device
220 on the SCSI channel.
221 @param Lun A pointer to the LUN of a SCSI device on the SCSI channel.
222
223 @retval EFI_SUCCESS DevicePath was successfully translated to a Target ID and
224 LUN, and they were returned in Target and Lun.
225 @retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL.
226 @retval EFI_NOT_FOUND A valid translation from DevicePath to a Target ID and LUN
227 does not exist.
228 @retval EFI_UNSUPPORTED This driver does not support the device path node type in
229 DevicePath.
230
231 **/
232 typedef
233 EFI_STATUS
234 (EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN) (
235 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
236 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
237 OUT UINT8 **Target,
238 OUT UINT64 *Lun
239 )
240 ;
241
242 /**
243 Resets a SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel.
244
245 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
246
247 @retval EFI_SUCCESS The SCSI channel was reset.
248 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI channel.
249 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI channel.
250 @retval EFI_UNSUPPORTED The SCSI channel does not support a channel reset operation.
251
252 **/
253 typedef
254 EFI_STATUS
255 (EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL) (
256 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
257 )
258 ;
259
260 /**
261 Resets a SCSI logical unit that is connected to a SCSI channel.
262
263 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
264 @param Target The Target is an array of size TARGET_MAX_BYTE and it represents the
265 target port ID of the SCSI device containing the SCSI logical unit to
266 reset. Transport drivers may chose to utilize a subset of this array to suit
267 the representation of their targets.
268 @param Lun The LUN of the SCSI device to reset.
269
270 @retval EFI_SUCCESS The SCSI device specified by Target and Lun was reset.
271 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.
272 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI device
273 specified by Target and Lun.
274 @retval EFI_UNSUPPORTED The SCSI channel does not support a target reset operation.
275 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI device
276 specified by Target and Lun.
277
278 **/
279 typedef
280 EFI_STATUS
281 (EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN) (
282 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
283 IN UINT8 *Target,
284 IN UINT64 Lun
285 )
286 ;
287
288 /**
289 Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either
290 be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs
291 for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to
292 see if a SCSI device is actually present at that location on the SCSI channel.
293
294 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
295 @param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.
296 On output, a pointer to the Target ID (an array of
297 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI
298 channel. An input value of 0xF(all bytes in the array are 0xF) in the
299 Target array retrieves the Target ID of the first SCSI device present on a
300 SCSI channel.
301
302 @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI
303 channel was returned in Target.
304 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.
305 @retval EFI_TIMEOUT Target array is not all 0xF, and Target were not
306 returned on a previous call to GetNextTarget().
307 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.
308
309 **/
310 typedef
311 EFI_STATUS
312 (EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET) (
313 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
314 IN OUT UINT8 **Target
315 )
316 ;
317
318 struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL {
319 EFI_EXT_SCSI_PASS_THRU_MODE *Mode;
320 EFI_EXT_SCSI_PASS_THRU_PASSTHRU PassThru;
321 EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN GetNextTargetLun;
322 EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;
323 EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN GetTargetLun;
324 EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL ResetChannel;
325 EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN ResetTargetLun;
326 EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET GetNextTarget;
327 };
328
329 extern EFI_GUID gEfiExtScsiPassThruProtocolGuid;
330
331 #endif