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