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