2 Copyright (c) 2006, Intel Corporation
3 All rights reserved. This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 EFI_SCSI_IO_PROTOCOL as defined in UEFI 2.0.
22 #ifndef __EFI_SCSI_IO_PROTOCOL_H__
23 #define __EFI_SCSI_IO_PROTOCOL_H__
25 #define EFI_SCSI_IO_PROTOCOL_GUID \
27 0x932f47e6, 0x2362, 0x4002, {0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \
31 // Forward reference for pure ANSI compatability
33 typedef struct _EFI_SCSI_IO_PROTOCOL EFI_SCSI_IO_PROTOCOL
;
36 // SCSI Data Direction definition
38 #define EFI_SCSI_IO_DATA_DIRECTION_READ 0
39 #define EFI_SCSI_IO_DATA_DIRECTION_WRITE 1
40 #define EFI_SCSI_IO_DATA_DIRECTION_BIDIRECTIONAL 2
43 // SCSI Host Adapter Status definition
45 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OK 0x00
46 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09 // timeout when processing the command
47 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT 0x0b // timeout when waiting for the command processing
48 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d // a message reject was received when processing command
49 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_RESET 0x0e // a bus reset was detected
50 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f
51 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10 // the adapter failed in issuing request sense command
52 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11 // selection timeout
53 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12 // data overrun or data underrun
54 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_FREE 0x13 // Unexepected bus free
55 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14 // Target bus phase sequence failure
56 #define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OTHER 0x7f
60 // SCSI Target Status definition
62 #define EFI_SCSI_IO_STATUS_TARGET_GOOD 0x00
63 #define EFI_SCSI_IO_STATUS_TARGET_CHECK_CONDITION 0x02 // check condition
64 #define EFI_SCSI_IO_STATUS_TARGET_CONDITION_MET 0x04 // condition met
65 #define EFI_SCSI_IO_STATUS_TARGET_BUSY 0x08 // busy
66 #define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE 0x10 // intermediate
67 #define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14 // intermediate-condition met
68 #define EFI_SCSI_IO_STATUS_TARGET_RESERVATION_CONFLICT 0x18 // reservation conflict
69 #define EFI_SCSI_IO_STATUS_TARGET_COMMOND_TERMINATED 0x22 // command terminated
70 #define EFI_SCSI_IO_STATUS_TARGET_QUEUE_FULL 0x28 // queue full
78 UINT32 InTransferLength
;
79 UINT32 OutTransferLength
;
82 UINT8 HostAdapterStatus
;
84 UINT8 SenseDataLength
;
85 } EFI_SCSI_IO_SCSI_REQUEST_PACKET
;
89 (EFIAPI
*EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE
) (
90 IN EFI_SCSI_IO_PROTOCOL
*This
,
96 Retrieves the device type information of the SCSI Controller.
99 This - Protocol instance pointer.
100 DeviceType - A pointer to the device type information
101 retrieved from the SCSI Controller.
104 EFI_SUCCESS - Retrieves the device type information successfully.
105 EFI_INVALID_PARAMETER - The DeviceType is NULL.
112 (EFIAPI
*EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION
) (
113 IN EFI_SCSI_IO_PROTOCOL
*This
,
114 IN OUT UINT8
**Target
,
120 Retrieves the device location in the SCSI channel.
123 This - Protocol instance pointer.
124 Target - A pointer to the Target Array which represents ID of a SCSI device
126 Lun - A pointer to the LUN of the SCSI device on
130 EFI_SUCCESS - Retrieves the device location successfully.
131 EFI_INVALID_PARAMETER - The Target or Lun is NULL.
138 (EFIAPI
*EFI_SCSI_IO_PROTOCOL_RESET_BUS
) (
139 IN EFI_SCSI_IO_PROTOCOL
*This
144 Resets the SCSI Bus that the SCSI Controller is attached to.
147 This - This Protocol instance pointer.
150 EFI_SUCCESS - The SCSI bus is reset successfully.
151 EFI_DEVICE_ERROR - Errors encountered when resetting the SCSI bus.
152 EFI_UNSUPPORTED - The bus reset operation is not supported by the
153 SCSI Host Controller.
154 EFI_TIMEOUT - A timeout occurred while attempting to reset
162 (EFIAPI
*EFI_SCSI_IO_PROTOCOL_RESET_DEVICE
) (
163 IN EFI_SCSI_IO_PROTOCOL
*This
168 Resets the SCSI Controller that the device handle specifies.
171 This - Protocol instance pointer.
174 EFI_SUCCESS - Reset the SCSI controller successfully.
175 EFI_DEVICE_ERROR - Errors are encountered when resetting the
177 EFI_UNSUPPORTED - The SCSI bus does not support a device
179 EFI_TIMEOUT - A timeout occurred while attempting to
180 reset the SCSI Controller.
187 (EFIAPI
*EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND
) (
188 IN EFI_SCSI_IO_PROTOCOL
*This
,
189 IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET
*Packet
,
190 IN EFI_EVENT Event OPTIONAL
195 Sends a SCSI Request Packet to the SCSI Controller for execution.
198 This - Protocol instance pointer.
199 Packet - The SCSI request packet to send to the SCSI
200 Controller specified by the device handle.
201 Event - If the SCSI bus where the SCSI device is attached
202 does not support non-blocking I/O, then Event is
203 ignored, and blocking I/O is performed.
204 If Event is NULL, then blocking I/O is performed.
205 If Event is not NULL and non-blocking I/O is
206 supported, then non-blocking I/O is performed,
207 and Event will be signaled when the SCSI Request
211 EFI_SUCCESS - The SCSI Request Packet was sent by the host
212 successfully, and TransferLength bytes were
213 transferred to/from DataBuffer.See
214 HostAdapterStatus, TargetStatus,
215 SenseDataLength, and SenseData in that order
216 for additional status information.
217 EFI_BAD_BUFFER_SIZE - The SCSI Request Packet was executed,
218 but the entire DataBuffer could not be transferred.
219 The actual number of bytes transferred is returned
220 in TransferLength. See HostAdapterStatus,
221 TargetStatus, SenseDataLength, and SenseData in
222 that order for additional status information.
223 EFI_NOT_READY - The SCSI Request Packet could not be sent because
224 there are too many SCSI Command Packets already
225 queued.The caller may retry again later.
226 EFI_DEVICE_ERROR - A device error occurred while attempting to send
227 the SCSI Request Packet. See HostAdapterStatus,
228 TargetStatus, SenseDataLength, and SenseData in
229 that order for additional status information.
230 EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
231 The SCSI Request Packet was not sent, so no
232 additional status information is available.
233 EFI_UNSUPPORTED - The command described by the SCSI Request Packet
234 is not supported by the SCSI initiator(i.e., SCSI
235 Host Controller). The SCSI Request Packet was not
236 sent, so no additional status information is
238 EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
239 Request Packet to execute. See HostAdapterStatus,
240 TargetStatus, SenseDataLength, and SenseData in
241 that order for additional status information.
245 struct _EFI_SCSI_IO_PROTOCOL
{
246 EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE GetDeviceType
;
247 EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION GetDeviceLocation
;
248 EFI_SCSI_IO_PROTOCOL_RESET_BUS ResetBus
;
249 EFI_SCSI_IO_PROTOCOL_RESET_DEVICE ResetDevice
;
250 EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND ExecuteScsiCommand
;
254 extern EFI_GUID gEfiScsiIoProtocolGuid
;