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