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