xref: /freebsd/sys/contrib/edk2/Include/Protocol/ScsiPassThruExt.h (revision f439973d6726c3be929c8fb3b1545b8b1744abc3)
1*f439973dSWarner Losh /** @file
2*f439973dSWarner Losh   EFI_EXT_SCSI_PASS_THRU_PROTOCOL as defined in UEFI 2.0.
3*f439973dSWarner Losh   This protocol provides services that allow SCSI Pass Thru commands
4*f439973dSWarner Losh   to be sent to SCSI devices attached to a SCSI channel.
5*f439973dSWarner Losh 
6*f439973dSWarner Losh   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
7*f439973dSWarner Losh   SPDX-License-Identifier: BSD-2-Clause-Patent
8*f439973dSWarner Losh 
9*f439973dSWarner Losh **/
10*f439973dSWarner Losh 
11*f439973dSWarner Losh #ifndef __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__
12*f439973dSWarner Losh #define __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__
13*f439973dSWarner Losh 
14*f439973dSWarner Losh #define EFI_EXT_SCSI_PASS_THRU_PROTOCOL_GUID \
15*f439973dSWarner Losh   { \
16*f439973dSWarner Losh     0x143b7632, 0xb81b, 0x4cb7, {0xab, 0xd3, 0xb6, 0x25, 0xa5, 0xb9, 0xbf, 0xfe } \
17*f439973dSWarner Losh   }
18*f439973dSWarner Losh 
19*f439973dSWarner Losh typedef struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL EFI_EXT_SCSI_PASS_THRU_PROTOCOL;
20*f439973dSWarner Losh 
21*f439973dSWarner Losh #define TARGET_MAX_BYTES  0x10
22*f439973dSWarner Losh 
23*f439973dSWarner Losh #define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL    0x0001
24*f439973dSWarner Losh #define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL     0x0002
25*f439973dSWarner Losh #define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO  0x0004
26*f439973dSWarner Losh 
27*f439973dSWarner Losh //
28*f439973dSWarner Losh // DataDirection
29*f439973dSWarner Losh //
30*f439973dSWarner Losh #define EFI_EXT_SCSI_DATA_DIRECTION_READ           0
31*f439973dSWarner Losh #define EFI_EXT_SCSI_DATA_DIRECTION_WRITE          1
32*f439973dSWarner Losh #define EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTIONAL  2
33*f439973dSWarner Losh //
34*f439973dSWarner Losh // HostAdapterStatus
35*f439973dSWarner Losh //
36*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK                     0x00
37*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND        0x09
38*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT                0x0b
39*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT         0x0d
40*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_RESET              0x0e
41*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR           0x0f
42*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED   0x10
43*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT      0x11
44*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN  0x12
45*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_FREE               0x13
46*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR            0x14
47*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER                  0x7f
48*f439973dSWarner Losh //
49*f439973dSWarner Losh // TargetStatus
50*f439973dSWarner Losh //
51*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_TARGET_GOOD                        0x00
52*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION             0x02
53*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_TARGET_CONDITION_MET               0x04
54*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_TARGET_BUSY                        0x08
55*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE                0x10
56*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET  0x14
57*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_TARGET_RESERVATION_CONFLICT        0x18
58*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_TARGET_TASK_SET_FULL               0x28
59*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_TARGET_ACA_ACTIVE                  0x30
60*f439973dSWarner Losh #define EFI_EXT_SCSI_STATUS_TARGET_TASK_ABORTED                0x40
61*f439973dSWarner Losh 
62*f439973dSWarner Losh typedef struct {
63*f439973dSWarner Losh   ///
64*f439973dSWarner Losh   /// The Target ID of the host adapter on the SCSI channel.
65*f439973dSWarner Losh   ///
66*f439973dSWarner Losh   UINT32    AdapterId;
67*f439973dSWarner Losh   ///
68*f439973dSWarner Losh   /// Additional information on the attributes of the SCSI channel.
69*f439973dSWarner Losh   ///
70*f439973dSWarner Losh   UINT32    Attributes;
71*f439973dSWarner Losh   ///
72*f439973dSWarner Losh   /// Supplies the alignment requirement for any buffer used in a data transfer.
73*f439973dSWarner Losh   ///
74*f439973dSWarner Losh   UINT32    IoAlign;
75*f439973dSWarner Losh } EFI_EXT_SCSI_PASS_THRU_MODE;
76*f439973dSWarner Losh 
77*f439973dSWarner Losh typedef struct {
78*f439973dSWarner Losh   ///
79*f439973dSWarner Losh   /// The timeout, in 100 ns units, to use for the execution of this SCSI
80*f439973dSWarner Losh   /// Request Packet. A Timeout value of 0 means that this function
81*f439973dSWarner Losh   /// will wait indefinitely for the SCSI Request Packet to execute. If
82*f439973dSWarner Losh   /// Timeout is greater than zero, then this function will return
83*f439973dSWarner Losh   /// EFI_TIMEOUT if the time required to execute the SCSI
84*f439973dSWarner Losh   /// Request Packet is greater than Timeout.
85*f439973dSWarner Losh   ///
86*f439973dSWarner Losh   UINT64    Timeout;
87*f439973dSWarner Losh   ///
88*f439973dSWarner Losh   /// A pointer to the data buffer to transfer between the SCSI
89*f439973dSWarner Losh   /// controller and the SCSI device for read and bidirectional commands.
90*f439973dSWarner Losh   ///
91*f439973dSWarner Losh   VOID      *InDataBuffer;
92*f439973dSWarner Losh   ///
93*f439973dSWarner Losh   /// A pointer to the data buffer to transfer between the SCSI
94*f439973dSWarner Losh   /// controller and the SCSI device for write or bidirectional commands.
95*f439973dSWarner Losh   ///
96*f439973dSWarner Losh   VOID      *OutDataBuffer;
97*f439973dSWarner Losh   ///
98*f439973dSWarner Losh   /// A pointer to the sense data that was generated by the execution of
99*f439973dSWarner Losh   /// the SCSI Request Packet.
100*f439973dSWarner Losh   ///
101*f439973dSWarner Losh   VOID      *SenseData;
102*f439973dSWarner Losh   ///
103*f439973dSWarner Losh   /// A pointer to buffer that contains the Command Data Block to
104*f439973dSWarner Losh   /// send to the SCSI device specified by Target and Lun.
105*f439973dSWarner Losh   ///
106*f439973dSWarner Losh   VOID      *Cdb;
107*f439973dSWarner Losh   ///
108*f439973dSWarner Losh   /// On Input, the size, in bytes, of InDataBuffer. On output, the
109*f439973dSWarner Losh   /// number of bytes transferred between the SCSI controller and the SCSI device.
110*f439973dSWarner Losh   ///
111*f439973dSWarner Losh   UINT32    InTransferLength;
112*f439973dSWarner Losh   ///
113*f439973dSWarner Losh   /// On Input, the size, in bytes of OutDataBuffer. On Output, the
114*f439973dSWarner Losh   /// Number of bytes transferred between SCSI Controller and the SCSI device.
115*f439973dSWarner Losh   ///
116*f439973dSWarner Losh   UINT32    OutTransferLength;
117*f439973dSWarner Losh   ///
118*f439973dSWarner Losh   /// The length, in bytes, of the buffer Cdb. The standard values are 6,
119*f439973dSWarner Losh   /// 10, 12, and 16, but other values are possible if a variable length CDB is used.
120*f439973dSWarner Losh   ///
121*f439973dSWarner Losh   UINT8     CdbLength;
122*f439973dSWarner Losh   ///
123*f439973dSWarner Losh   /// The direction of the data transfer. 0 for reads, 1 for writes. A
124*f439973dSWarner Losh   /// value of 2 is Reserved for Bi-Directional SCSI commands.
125*f439973dSWarner Losh   ///
126*f439973dSWarner Losh   UINT8     DataDirection;
127*f439973dSWarner Losh   ///
128*f439973dSWarner Losh   /// The status of the host adapter specified by This when the SCSI
129*f439973dSWarner Losh   /// Request Packet was executed on the target device.
130*f439973dSWarner Losh   ///
131*f439973dSWarner Losh   UINT8     HostAdapterStatus;
132*f439973dSWarner Losh   ///
133*f439973dSWarner Losh   /// The status returned by the device specified by Target and Lun
134*f439973dSWarner Losh   /// when the SCSI Request Packet was executed.
135*f439973dSWarner Losh   ///
136*f439973dSWarner Losh   UINT8     TargetStatus;
137*f439973dSWarner Losh   ///
138*f439973dSWarner Losh   /// On input, the length in bytes of the SenseData buffer. On
139*f439973dSWarner Losh   /// output, the number of bytes written to the SenseData buffer.
140*f439973dSWarner Losh   ///
141*f439973dSWarner Losh   UINT8     SenseDataLength;
142*f439973dSWarner Losh } EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;
143*f439973dSWarner Losh 
144*f439973dSWarner Losh /**
145*f439973dSWarner Losh   Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function
146*f439973dSWarner Losh   supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the
147*f439973dSWarner Losh   nonblocking I/O functionality is optional.
148*f439973dSWarner Losh 
149*f439973dSWarner Losh   @param  This    A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
150*f439973dSWarner Losh   @param  Target  The Target is an array of size TARGET_MAX_BYTES and it represents
151*f439973dSWarner Losh                   the id of the SCSI device to send the SCSI Request Packet. Each
152*f439973dSWarner Losh                   transport driver may choose to utilize a subset of this size to suit the needs
153*f439973dSWarner Losh                   of transport target representation. For example, a Fibre Channel driver
154*f439973dSWarner Losh                   may use only 8 bytes (WWN) to represent an FC target.
155*f439973dSWarner Losh   @param  Lun     The LUN of the SCSI device to send the SCSI Request Packet.
156*f439973dSWarner Losh   @param  Packet  A pointer to the SCSI Request Packet to send to the SCSI device
157*f439973dSWarner Losh                   specified by Target and Lun.
158*f439973dSWarner Losh   @param  Event   If nonblocking I/O is not supported then Event is ignored, and blocking
159*f439973dSWarner Losh                   I/O is performed. If Event is NULL, then blocking I/O is performed. If
160*f439973dSWarner Losh                   Event is not NULL and non blocking I/O is supported, then
161*f439973dSWarner Losh                   nonblocking I/O is performed, and Event will be signaled when the
162*f439973dSWarner Losh                   SCSI Request Packet completes.
163*f439973dSWarner Losh 
164*f439973dSWarner Losh   @retval EFI_SUCCESS           The SCSI Request Packet was sent by the host. For bi-directional
165*f439973dSWarner Losh                                 commands, InTransferLength bytes were transferred from
166*f439973dSWarner Losh                                 InDataBuffer. For write and bi-directional commands,
167*f439973dSWarner Losh                                 OutTransferLength bytes were transferred by
168*f439973dSWarner Losh                                 OutDataBuffer.
169*f439973dSWarner Losh   @retval EFI_BAD_BUFFER_SIZE   The SCSI Request Packet was not executed. The number of bytes that
170*f439973dSWarner Losh                                 could be transferred is returned in InTransferLength. For write
171*f439973dSWarner Losh                                 and bi-directional commands, OutTransferLength bytes were
172*f439973dSWarner Losh                                 transferred by OutDataBuffer.
173*f439973dSWarner Losh   @retval EFI_NOT_READY         The SCSI Request Packet could not be sent because there are too many
174*f439973dSWarner Losh                                 SCSI Request Packets already queued. The caller may retry again later.
175*f439973dSWarner Losh   @retval EFI_DEVICE_ERROR      A device error occurred while attempting to send the SCSI Request
176*f439973dSWarner Losh                                 Packet.
177*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket are invalid.
178*f439973dSWarner Losh   @retval EFI_UNSUPPORTED       The command described by the SCSI Request Packet is not supported
179*f439973dSWarner Losh                                 by the host adapter. This includes the case of Bi-directional SCSI
180*f439973dSWarner Losh                                 commands not supported by the implementation. The SCSI Request
181*f439973dSWarner Losh                                 Packet was not sent, so no additional status information is available.
182*f439973dSWarner Losh   @retval EFI_TIMEOUT           A timeout occurred while waiting for the SCSI Request Packet to execute.
183*f439973dSWarner Losh 
184*f439973dSWarner Losh **/
185*f439973dSWarner Losh typedef
186*f439973dSWarner Losh EFI_STATUS
187*f439973dSWarner Losh (EFIAPI *EFI_EXT_SCSI_PASS_THRU_PASSTHRU)(
188*f439973dSWarner Losh   IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL                *This,
189*f439973dSWarner Losh   IN UINT8                                          *Target,
190*f439973dSWarner Losh   IN UINT64                                         Lun,
191*f439973dSWarner Losh   IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
192*f439973dSWarner Losh   IN EFI_EVENT                                      Event     OPTIONAL
193*f439973dSWarner Losh   );
194*f439973dSWarner Losh 
195*f439973dSWarner Losh /**
196*f439973dSWarner Losh   Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These
197*f439973dSWarner Losh   can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal
198*f439973dSWarner Losh   Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the
199*f439973dSWarner Losh   Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI
200*f439973dSWarner Losh   channel.
201*f439973dSWarner Losh 
202*f439973dSWarner Losh   @param  This   A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
203*f439973dSWarner Losh   @param  Target On input, a pointer to the Target ID (an array of size
204*f439973dSWarner Losh                  TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.
205*f439973dSWarner Losh                  On output, a pointer to the Target ID (an array of
206*f439973dSWarner Losh                  TARGET_MAX_BYTES) of the next SCSI device present on a SCSI
207*f439973dSWarner Losh                  channel. An input value of 0xF(all bytes in the array are 0xF) in the
208*f439973dSWarner Losh                  Target array retrieves the Target ID of the first SCSI device present on a
209*f439973dSWarner Losh                  SCSI channel.
210*f439973dSWarner Losh   @param  Lun    On input, a pointer to the LUN of a SCSI device present on the SCSI
211*f439973dSWarner Losh                  channel. On output, a pointer to the LUN of the next SCSI device present
212*f439973dSWarner Losh                  on a SCSI channel.
213*f439973dSWarner Losh 
214*f439973dSWarner Losh   @retval EFI_SUCCESS           The Target ID and LUN of the next SCSI device on the SCSI
215*f439973dSWarner Losh                                 channel was returned in Target and Lun.
216*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER Target array is not all 0xF, and Target and Lun were
217*f439973dSWarner Losh                                 not returned on a previous call to GetNextTargetLun().
218*f439973dSWarner Losh   @retval EFI_NOT_FOUND         There are no more SCSI devices on this SCSI channel.
219*f439973dSWarner Losh 
220*f439973dSWarner Losh **/
221*f439973dSWarner Losh typedef
222*f439973dSWarner Losh EFI_STATUS
223*f439973dSWarner Losh (EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN)(
224*f439973dSWarner Losh   IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL                *This,
225*f439973dSWarner Losh   IN OUT UINT8                                      **Target,
226*f439973dSWarner Losh   IN OUT UINT64                                     *Lun
227*f439973dSWarner Losh   );
228*f439973dSWarner Losh 
229*f439973dSWarner Losh /**
230*f439973dSWarner Losh   Used to allocate and build a device path node for a SCSI device on a SCSI channel.
231*f439973dSWarner Losh 
232*f439973dSWarner Losh   @param  This       A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
233*f439973dSWarner Losh   @param  Target     The Target is an array of size TARGET_MAX_BYTES and it specifies the
234*f439973dSWarner Losh                      Target ID of the SCSI device for which a device path node is to be
235*f439973dSWarner Losh                      allocated and built. Transport drivers may chose to utilize a subset of
236*f439973dSWarner Losh                      this size to suit the representation of targets. For example, a Fibre
237*f439973dSWarner Losh                      Channel driver may use only 8 bytes (WWN) in the array to represent a
238*f439973dSWarner Losh                      FC target.
239*f439973dSWarner Losh   @param  Lun        The LUN of the SCSI device for which a device path node is to be
240*f439973dSWarner Losh                      allocated and built.
241*f439973dSWarner Losh   @param  DevicePath A pointer to a single device path node that describes the SCSI device
242*f439973dSWarner Losh                      specified by Target and Lun. This function is responsible for
243*f439973dSWarner Losh                      allocating the buffer DevicePath with the boot service
244*f439973dSWarner Losh                      AllocatePool(). It is the caller's responsibility to free
245*f439973dSWarner Losh                      DevicePath when the caller is finished with DevicePath.
246*f439973dSWarner Losh 
247*f439973dSWarner Losh   @retval EFI_SUCCESS           The device path node that describes the SCSI device specified by
248*f439973dSWarner Losh                                 Target and Lun was allocated and returned in
249*f439973dSWarner Losh                                 DevicePath.
250*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER DevicePath is NULL.
251*f439973dSWarner Losh   @retval EFI_NOT_FOUND         The SCSI devices specified by Target and Lun does not exist
252*f439973dSWarner Losh                                 on the SCSI channel.
253*f439973dSWarner Losh   @retval EFI_OUT_OF_RESOURCES  There are not enough resources to allocate DevicePath.
254*f439973dSWarner Losh 
255*f439973dSWarner Losh **/
256*f439973dSWarner Losh typedef
257*f439973dSWarner Losh EFI_STATUS
258*f439973dSWarner Losh (EFIAPI *EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH)(
259*f439973dSWarner Losh   IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL               *This,
260*f439973dSWarner Losh   IN UINT8                                         *Target,
261*f439973dSWarner Losh   IN UINT64                                        Lun,
262*f439973dSWarner Losh   OUT EFI_DEVICE_PATH_PROTOCOL                     **DevicePath
263*f439973dSWarner Losh   );
264*f439973dSWarner Losh 
265*f439973dSWarner Losh /**
266*f439973dSWarner Losh   Used to translate a device path node to a Target ID and LUN.
267*f439973dSWarner Losh 
268*f439973dSWarner Losh   @param  This       A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
269*f439973dSWarner Losh   @param  DevicePath A pointer to a single device path node that describes the SCSI device
270*f439973dSWarner Losh                      on the SCSI channel.
271*f439973dSWarner Losh   @param  Target     A pointer to the Target Array which represents the ID of a SCSI device
272*f439973dSWarner Losh                      on the SCSI channel.
273*f439973dSWarner Losh   @param  Lun        A pointer to the LUN of a SCSI device on the SCSI channel.
274*f439973dSWarner Losh 
275*f439973dSWarner Losh   @retval EFI_SUCCESS           DevicePath was successfully translated to a Target ID and
276*f439973dSWarner Losh                                 LUN, and they were returned in Target and Lun.
277*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL.
278*f439973dSWarner Losh   @retval EFI_NOT_FOUND         A valid translation from DevicePath to a Target ID and LUN
279*f439973dSWarner Losh                                 does not exist.
280*f439973dSWarner Losh   @retval EFI_UNSUPPORTED       This driver does not support the device path node type in
281*f439973dSWarner Losh                                  DevicePath.
282*f439973dSWarner Losh 
283*f439973dSWarner Losh **/
284*f439973dSWarner Losh typedef
285*f439973dSWarner Losh EFI_STATUS
286*f439973dSWarner Losh (EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN)(
287*f439973dSWarner Losh   IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL               *This,
288*f439973dSWarner Losh   IN EFI_DEVICE_PATH_PROTOCOL                      *DevicePath,
289*f439973dSWarner Losh   OUT UINT8                                        **Target,
290*f439973dSWarner Losh   OUT UINT64                                       *Lun
291*f439973dSWarner Losh   );
292*f439973dSWarner Losh 
293*f439973dSWarner Losh /**
294*f439973dSWarner Losh   Resets a SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel.
295*f439973dSWarner Losh 
296*f439973dSWarner Losh   @param  This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
297*f439973dSWarner Losh 
298*f439973dSWarner Losh   @retval EFI_SUCCESS      The SCSI channel was reset.
299*f439973dSWarner Losh   @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI channel.
300*f439973dSWarner Losh   @retval EFI_TIMEOUT      A timeout occurred while attempting to reset the SCSI channel.
301*f439973dSWarner Losh   @retval EFI_UNSUPPORTED  The SCSI channel does not support a channel reset operation.
302*f439973dSWarner Losh 
303*f439973dSWarner Losh **/
304*f439973dSWarner Losh typedef
305*f439973dSWarner Losh EFI_STATUS
306*f439973dSWarner Losh (EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL)(
307*f439973dSWarner Losh   IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL               *This
308*f439973dSWarner Losh   );
309*f439973dSWarner Losh 
310*f439973dSWarner Losh /**
311*f439973dSWarner Losh   Resets a SCSI logical unit that is connected to a SCSI channel.
312*f439973dSWarner Losh 
313*f439973dSWarner Losh   @param  This   A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
314*f439973dSWarner Losh   @param  Target The Target is an array of size TARGET_MAX_BYTE and it represents the
315*f439973dSWarner Losh                  target port ID of the SCSI device containing the SCSI logical unit to
316*f439973dSWarner Losh                  reset. Transport drivers may chose to utilize a subset of this array to suit
317*f439973dSWarner Losh                  the representation of their targets.
318*f439973dSWarner Losh   @param  Lun    The LUN of the SCSI device to reset.
319*f439973dSWarner Losh 
320*f439973dSWarner Losh   @retval EFI_SUCCESS           The SCSI device specified by Target and Lun was reset.
321*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER Target or Lun is NULL.
322*f439973dSWarner Losh   @retval EFI_TIMEOUT           A timeout occurred while attempting to reset the SCSI device
323*f439973dSWarner Losh                                 specified by Target and Lun.
324*f439973dSWarner Losh   @retval EFI_UNSUPPORTED       The SCSI channel does not support a target reset operation.
325*f439973dSWarner Losh   @retval EFI_DEVICE_ERROR      A device error occurred while attempting to reset the SCSI device
326*f439973dSWarner Losh                                  specified by Target and Lun.
327*f439973dSWarner Losh 
328*f439973dSWarner Losh **/
329*f439973dSWarner Losh typedef
330*f439973dSWarner Losh EFI_STATUS
331*f439973dSWarner Losh (EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN)(
332*f439973dSWarner Losh   IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL               *This,
333*f439973dSWarner Losh   IN UINT8                                         *Target,
334*f439973dSWarner Losh   IN UINT64                                        Lun
335*f439973dSWarner Losh   );
336*f439973dSWarner Losh 
337*f439973dSWarner Losh /**
338*f439973dSWarner Losh   Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either
339*f439973dSWarner Losh   be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs
340*f439973dSWarner Losh   for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to
341*f439973dSWarner Losh   see if a SCSI device is actually present at that location on the SCSI channel.
342*f439973dSWarner Losh 
343*f439973dSWarner Losh   @param  This   A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
344*f439973dSWarner Losh   @param  Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.
345*f439973dSWarner Losh                  On output, a pointer to the Target ID (an array of
346*f439973dSWarner Losh                  TARGET_MAX_BYTES) of the next SCSI device present on a SCSI
347*f439973dSWarner Losh                  channel. An input value of 0xF(all bytes in the array are 0xF) in the
348*f439973dSWarner Losh                  Target array retrieves the Target ID of the first SCSI device present on a
349*f439973dSWarner Losh                  SCSI channel.
350*f439973dSWarner Losh 
351*f439973dSWarner Losh   @retval EFI_SUCCESS           The Target ID of the next SCSI device on the SCSI
352*f439973dSWarner Losh                                 channel was returned in Target.
353*f439973dSWarner Losh   @retval EFI_INVALID_PARAMETER Target or Lun is NULL.
354*f439973dSWarner Losh   @retval EFI_TIMEOUT           Target array is not all 0xF, and Target was not
355*f439973dSWarner Losh                                 returned on a previous call to GetNextTarget().
356*f439973dSWarner Losh   @retval EFI_NOT_FOUND         There are no more SCSI devices on this SCSI channel.
357*f439973dSWarner Losh 
358*f439973dSWarner Losh **/
359*f439973dSWarner Losh typedef
360*f439973dSWarner Losh EFI_STATUS
361*f439973dSWarner Losh (EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET)(
362*f439973dSWarner Losh   IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL               *This,
363*f439973dSWarner Losh   IN OUT UINT8                                     **Target
364*f439973dSWarner Losh   );
365*f439973dSWarner Losh 
366*f439973dSWarner Losh ///
367*f439973dSWarner Losh /// The EFI_EXT_SCSI_PASS_THRU_PROTOCOL provides information about a SCSI channel
368*f439973dSWarner Losh /// and the ability to send SCI Request Packets to any SCSI device attached to
369*f439973dSWarner Losh /// that SCSI channel. The information includes the Target ID of the host controller
370*f439973dSWarner Losh /// on the SCSI channel and the attributes of the SCSI channel.
371*f439973dSWarner Losh ///
372*f439973dSWarner Losh struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL {
373*f439973dSWarner Losh   ///
374*f439973dSWarner Losh   /// A pointer to the EFI_EXT_SCSI_PASS_THRU_MODE data for this SCSI channel.
375*f439973dSWarner Losh   ///
376*f439973dSWarner Losh   EFI_EXT_SCSI_PASS_THRU_MODE                   *Mode;
377*f439973dSWarner Losh   EFI_EXT_SCSI_PASS_THRU_PASSTHRU               PassThru;
378*f439973dSWarner Losh   EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN    GetNextTargetLun;
379*f439973dSWarner Losh   EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH      BuildDevicePath;
380*f439973dSWarner Losh   EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN         GetTargetLun;
381*f439973dSWarner Losh   EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL          ResetChannel;
382*f439973dSWarner Losh   EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN       ResetTargetLun;
383*f439973dSWarner Losh   EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET        GetNextTarget;
384*f439973dSWarner Losh };
385*f439973dSWarner Losh 
386*f439973dSWarner Losh extern EFI_GUID  gEfiExtScsiPassThruProtocolGuid;
387*f439973dSWarner Losh 
388*f439973dSWarner Losh #endif
389