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