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