]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/ScsiIoExt.h
Update the Guid Value of Ext SCSI Pass Thru Protocol
[mirror_edk2.git] / MdePkg / Include / Protocol / ScsiIoExt.h
1 /** @file
2 EFI_SCSI_IO_PROTOCOL as defined in UEFI 2.0.
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Module Name: ScsiIoExt.h
14
15 **/
16
17 #ifndef __EFI_SCSI_IO_PROTOCOL_H__
18 #define __EFI_SCSI_IO_PROTOCOL_H__
19
20 #define EFI_SCSI_IO_PROTOCOL_GUID \
21 { \
22 0x932f4736, 0x2362, 0x4002, {0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \
23 }
24
25 //
26 // Forward reference for pure ANSI compatability
27 //
28 typedef struct _EFI_SCSI_IO_PROTOCOL EFI_SCSI_IO_PROTOCOL;
29
30 //
31 // SCSI Data Direction definition
32 //
33 #define EFI_SCSI_IO_DATA_DIRECTION_READ 0
34 #define EFI_SCSI_IO_DATA_DIRECTION_WRITE 1
35 #define EFI_SCSI_IO_DATA_DIRECTION_BIDIRECTIONAL 2
36
37 //
38 // SCSI Host Adapter Status definition
39 //
40 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OK 0x00
41 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09 // timeout when processing the command
42 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT 0x0b // timeout when waiting for the command processing
43 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d // a message reject was received when processing command
44 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_RESET 0x0e // a bus reset was detected
45 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f
46 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10 // the adapter failed in issuing request sense command
47 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11 // selection timeout
48 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12 // data overrun or data underrun
49 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_FREE 0x13 // Unexepected bus free
50 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14 // Target bus phase sequence failure
51 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OTHER 0x7f
52
53
54 //
55 // SCSI Target Status definition
56 //
57 #define EFI_SCSI_IO_STATUS_TARGET_GOOD 0x00
58 #define EFI_SCSI_IO_STATUS_TARGET_CHECK_CONDITION 0x02 // check condition
59 #define EFI_SCSI_IO_STATUS_TARGET_CONDITION_MET 0x04 // condition met
60 #define EFI_SCSI_IO_STATUS_TARGET_BUSY 0x08 // busy
61 #define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE 0x10 // intermediate
62 #define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14 // intermediate-condition met
63 #define EFI_SCSI_IO_STATUS_TARGET_RESERVATION_CONFLICT 0x18 // reservation conflict
64 #define EFI_SCSI_IO_STATUS_TARGET_COMMOND_TERMINATED 0x22 // command terminated
65 #define EFI_SCSI_IO_STATUS_TARGET_QUEUE_FULL 0x28 // queue full
66
67 typedef struct {
68 UINT64 Timeout;
69 VOID *InDataBuffer;
70 VOID *OutDataBuffer;
71 VOID *SenseData;
72 VOID *Cdb;
73 UINT32 InTransferLength;
74 UINT32 OutTransferLength;
75 UINT8 CdbLength;
76 UINT8 DataDirection;
77 UINT8 HostAdapterStatus;
78 UINT8 TargetStatus;
79 UINT8 SenseDataLength;
80 } EFI_SCSI_IO_SCSI_REQUEST_PACKET;
81
82 /**
83 Retrieves the device type information of the SCSI Controller.
84
85 @param This Protocol instance pointer.
86 @param DeviceType A pointer to the device type information
87 retrieved from the SCSI Controller.
88
89 @retval EFI_SUCCESS Retrieves the device type information successfully.
90 @retval EFI_INVALID_PARAMETER The DeviceType is NULL.
91
92 **/
93 typedef
94 EFI_STATUS
95 (EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE) (
96 IN EFI_SCSI_IO_PROTOCOL *This,
97 OUT UINT8 *DeviceType
98 )
99 ;
100
101 /**
102 Retrieves the device location in the SCSI channel.
103
104 @param This Protocol instance pointer.
105 @param Target A pointer to the Target ID of a SCSI device
106 on the SCSI channel.
107 @param Lun A pointer to the LUN of the SCSI device on
108 the SCSI channel.
109
110 @retval EFI_SUCCESS Retrieves the device location successfully.
111 @retval EFI_INVALID_PARAMETER The Target or Lun is NULL.
112
113 **/
114 typedef
115 EFI_STATUS
116 (EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION) (
117 IN EFI_SCSI_IO_PROTOCOL *This,
118 IN OUT UINT8 **Target,
119 OUT UINT64 *Lun
120 )
121 ;
122
123 /**
124 Resets the SCSI Bus that the SCSI Controller is attached to.
125
126 @param This Protocol instance pointer.
127
128 @retval EFI_SUCCESS The SCSI bus is reset successfully.
129 @retval EFI_DEVICE_ERROR Errors encountered when resetting the SCSI bus.
130 @retval EFI_UNSUPPORTED The bus reset operation is not supported by the
131 SCSI Host Controller.
132 @retval EFI_TIMEOUT A timeout occurred while attempting to reset
133 the SCSI bus.
134
135 **/
136 typedef
137 EFI_STATUS
138 (EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_BUS) (
139 IN EFI_SCSI_IO_PROTOCOL *This
140 )
141 ;
142
143 /**
144 Resets the SCSI Controller that the device handle specifies.
145
146 @param This Protocol instance pointer.
147
148 @retval EFI_SUCCESS Reset the SCSI controller successfully.
149 @retval EFI_DEVICE_ERROR Errors are encountered when resetting the
150 SCSI Controller.
151 @retval EFI_UNSUPPORTED The SCSI bus does not support a device
152 reset operation.
153 @retval EFI_TIMEOUT A timeout occurred while attempting to
154 reset the SCSI Controller.
155
156 **/
157 typedef
158 EFI_STATUS
159 (EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_DEVICE) (
160 IN EFI_SCSI_IO_PROTOCOL *This
161 )
162 ;
163
164
165 /**
166 Sends a SCSI Request Packet to the SCSI Controller for execution.
167
168 @param This Protocol instance pointer.
169 @param Packet The SCSI request packet to send to the SCSI
170 Controller specified by the device handle.
171 @param Event If the SCSI bus where the SCSI device is attached
172 does not support non-blocking I/O, then Event is
173 ignored, and blocking I/O is performed.
174 If Event is NULL, then blocking I/O is performed.
175 If Event is not NULL and non-blocking I/O is
176 supported, then non-blocking I/O is performed,
177 and Event will be signaled when the SCSI Request
178 Packet completes.
179
180 @retval EFI_SUCCESS The SCSI Request Packet was sent by the host
181 successfully, and TransferLength bytes were
182 transferred to/from DataBuffer.See
183 HostAdapterStatus, TargetStatus,
184 SenseDataLength, and SenseData in that order
185 for additional status information.
186 @retval EFI_WARN_BUFFER_TOO_SMALL The SCSI Request Packet was executed,
187 but the entire DataBuffer could not be transferred.
188 The actual number of bytes transferred is returned
189 in TransferLength. See HostAdapterStatus,
190 TargetStatus, SenseDataLength, and SenseData in
191 that order for additional status information.
192 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because
193 there are too many SCSI Command Packets already
194 queued.The caller may retry again later.
195 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send
196 the SCSI Request Packet. See HostAdapterStatus,
197 TargetStatus, SenseDataLength, and SenseData in
198 that order for additional status information.
199 @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid.
200 The SCSI Request Packet was not sent, so no
201 additional status information is available.
202 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
203 is not supported by the SCSI initiator(i.e., SCSI
204 Host Controller). The SCSI Request Packet was not
205 sent, so no additional status information is
206 available.
207 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI
208 Request Packet to execute. See HostAdapterStatus,
209 TargetStatus, SenseDataLength, and SenseData in
210 that order for additional status information.
211
212 **/
213 typedef
214 EFI_STATUS
215 (EFIAPI *EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND) (
216 IN EFI_SCSI_IO_PROTOCOL *This,
217 IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet,
218 IN EFI_EVENT Event OPTIONAL
219 )
220 ;
221
222 struct _EFI_SCSI_IO_PROTOCOL {
223 EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE GetDeviceType;
224 EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION GetDeviceLocation;
225 EFI_SCSI_IO_PROTOCOL_RESET_BUS ResetBus;
226 EFI_SCSI_IO_PROTOCOL_RESET_DEVICE ResetDevice;
227 EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND ExecuteSCSICommand;
228 UINT32 IoAlign;
229 };
230
231 extern EFI_GUID gEfiScsiIoProtocolGuid;
232
233 #endif