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