]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Efi/Protocol/ScsiPassThru/ScsiPassThru.h
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Efi / Protocol / ScsiPassThru / ScsiPassThru.h
CommitLineData
3eb9473e 1/*++\r
2\r
f57387d5
HT
3Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials \r
3eb9473e 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 ScsiPassThru.h\r
15\r
16Abstract:\r
17\r
18 SCSI Pass Through protocol.\r
19\r
20--*/\r
21\r
22#ifndef __SCSI_PT_H__\r
23#define __SCSI_PT_H__\r
24\r
25#define EFI_SCSI_PASS_THRU_PROTOCOL_GUID \\r
26 { \\r
7ccf38a3 27 0xa59e8fcf, 0xbda0, 0x43bb, {0x90, 0xb1, 0xd3, 0x73, 0x2e, 0xca, 0xa8, 0x77} \\r
3eb9473e 28 }\r
29\r
30//\r
31// Forward reference for pure ANSI compatability\r
32//\r
33EFI_FORWARD_DECLARATION (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
67typedef struct {\r
68 UINT64 Timeout;\r
69 VOID *DataBuffer;\r
70 VOID *SenseData;\r
71 VOID *Cdb;\r
72 UINT32 TransferLength;\r
73 UINT8 CdbLength;\r
74 UINT8 DataDirection;\r
75 UINT8 HostAdapterStatus;\r
76 UINT8 TargetStatus;\r
77 UINT8 SenseDataLength;\r
78} EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;\r
79\r
80typedef struct {\r
81 CHAR16 *ControllerName;\r
82 CHAR16 *ChannelName;\r
83 UINT32 AdapterId;\r
84 UINT32 Attributes;\r
85 UINT32 IoAlign;\r
86} EFI_SCSI_PASS_THRU_MODE;\r
87\r
88typedef\r
89EFI_STATUS\r
90(EFIAPI *EFI_SCSI_PASS_THRU_PASSTHRU) (\r
91 IN EFI_SCSI_PASS_THRU_PROTOCOL * This,\r
92 IN UINT32 Target,\r
93 IN UINT64 Lun,\r
94 IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET * Packet,\r
95 IN EFI_EVENT Event OPTIONAL\r
96 )\r
97/*++\r
98\r
99 Routine Description:\r
100 Sends a SCSI Request Packet to a SCSI device that is attached to \r
101 the SCSI channel. This function supports both blocking I/O and \r
102 non-blocking I/O. The blocking I/O functionality is required, \r
103 and the non-blocking I/O functionality is optional.\r
104\r
105 Arguments:\r
106 This - Protocol instance pointer.\r
107 Target - The Target ID of the SCSI device to \r
108 send the SCSI Request Packet.\r
109 Lun - The LUN of the SCSI device to send the \r
110 SCSI Request Packet. \r
111 Packet - A pointer to the SCSI Request Packet to send \r
112 to the SCSI device specified by Target and Lun.\r
113 Event - If non-blocking I/O is not supported then Event \r
114 is ignored, and blocking I/O is performed. \r
115 If Event is NULL, then blocking I/O is performed.\r
116 If Event is not NULL and non blocking I/O is \r
117 supported, then non-blocking I/O is performed, \r
118 and Event will be signaled when the SCSI Request \r
119 Packet completes\r
120\r
121 Returns:\r
122 EFI_SUCCESSThe - SCSI Request Packet was sent by the host, and \r
123 TransferLength bytes were transferred to/from \r
124 DataBuffer.See HostAdapterStatus, TargetStatus,\r
125 SenseDataLength,and SenseData in that order \r
126 for additional status information.\r
127 EFI_BAD_BUFFER_SIZE - The SCSI Request Packet was executed, but the \r
128 entire DataBuffer could not be transferred.\r
129 The actual number of bytes transferred is returned\r
130 in TransferLength. See HostAdapterStatus, \r
131 TargetStatus, SenseDataLength, and SenseData in \r
132 that order for additional status information.\r
133 EFI_NOT_READY - The SCSI Request Packet could not be sent because\r
134 there are too many SCSI Request Packets already \r
135 queued. The caller may retry again later.\r
136 EFI_DEVICE_ERROR - A device error occurred while attempting to send \r
137 the SCSI Request Packet. See HostAdapterStatus, \r
138 TargetStatus, SenseDataLength, and SenseData in \r
139 that order for additional status information.\r
140 EFI_INVALID_PARAMETER - Target, Lun, or the contents of ScsiRequestPacket\r
141 are invalid. The SCSI Request Packet was not sent,\r
142 so no additional status information is available.\r
143 EFI_UNSUPPORTED - The command described by the SCSI Request Packet \r
144 is not supported by the host adapter. The SCSI \r
145 Request Packet was not sent, so no additional \r
146 status information is available.\r
147 EFI_TIMEOUT - A timeout occurred while waiting for the SCSI \r
148 Request Packet to execute. See HostAdapterStatus,\r
149 TargetStatus, SenseDataLength, and SenseData in \r
150 that order for additional status information.\r
151\r
152--*/\r
153;\r
154\r
155typedef\r
156EFI_STATUS\r
157(EFIAPI *EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE) (\r
158 IN EFI_SCSI_PASS_THRU_PROTOCOL * This,\r
159 IN OUT UINT32 *Target,\r
160 IN OUT UINT64 *Lun\r
161 )\r
162/*++\r
163\r
164 Routine Description:\r
165 Used to retrieve the list of legal Target IDs for SCSI devices \r
166 on a SCSI channel.\r
167\r
168 Arguments:\r
169 This - Protocol instance pointer.\r
170 Target - On input, a pointer to the Target ID of a \r
171 SCSI device present on the SCSI channel.\r
172 On output, a pointer to the Target ID of \r
173 the next SCSI device present on a SCSI channel.\r
174 An input value of 0xFFFFFFFF retrieves the \r
175 Target ID of the first SCSI device present on \r
176 a SCSI channel.\r
177 Lun - On input, a pointer to the LUN of a SCSI device\r
178 present on the SCSI channel.On output, a pointer\r
179 to the LUN of the next SCSI device present on a \r
180 SCSI channel. \r
181 Returns:\r
182 EFI_SUCCESS - The Target ID of the next SCSI device on the SCSI\r
183 channel was returned in Target and Lun.\r
184 EFI_NOT_FOUND - There are no more SCSI devices on this SCSI channel.\r
185 EFI_INVALID_PARAMETER - Target is not 0xFFFFFFFF, and Target and Lun were \r
186 not returned on a previous call to GetNextDevice().\r
187--*/\r
188;\r
189\r
190typedef\r
191EFI_STATUS\r
192(EFIAPI *EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH) (\r
193 IN EFI_SCSI_PASS_THRU_PROTOCOL * This,\r
194 IN UINT32 Target,\r
195 IN UINT64 Lun,\r
196 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
197 )\r
198/*++\r
199\r
200 Routine Description:\r
201 Used to allocate and build a device path node for a SCSI device \r
202 on a SCSI channel.\r
203\r
204 Arguments:\r
205 This - Protocol instance pointer.\r
206 Target - The Target ID of the SCSI device for which\r
207 a device path node is to be allocated and built.\r
208 Lun - The LUN of the SCSI device for which a device \r
209 path node is to be allocated and built.\r
210 DevicePath - A pointer to a single device path node that \r
211 describes the SCSI device specified by \r
212 Target and Lun. This function is responsible \r
213 for allocating the buffer DevicePath with the boot\r
214 service AllocatePool(). It is the caller's \r
215 responsibility to free DevicePath when the caller\r
216 is finished with DevicePath. \r
217 Returns:\r
218 EFI_SUCCESS - The device path node that describes the SCSI device\r
219 specified by Target and Lun was allocated and \r
220 returned in DevicePath.\r
221 EFI_NOT_FOUND - The SCSI devices specified by Target and Lun does\r
222 not exist on the SCSI channel.\r
223 EFI_INVALID_PARAMETER - DevicePath is NULL.\r
224 EFI_OUT_OF_RESOURCES - There are not enough resources to allocate \r
225 DevicePath.\r
226--*/\r
227;\r
228\r
229typedef\r
230EFI_STATUS\r
231(EFIAPI *EFI_SCSI_PASS_THRU_GET_TARGET_LUN) (\r
232 IN EFI_SCSI_PASS_THRU_PROTOCOL * This,\r
233 IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,\r
234 OUT UINT32 *Target,\r
235 OUT UINT64 *Lun\r
236 )\r
237/*++\r
238\r
239 Routine Description:\r
240 Used to translate a device path node to a Target ID and LUN.\r
241\r
242 Arguments:\r
243 This - Protocol instance pointer.\r
244 DevicePath - A pointer to the device path node that \r
245 describes a SCSI device on the SCSI channel.\r
246 Target - A pointer to the Target ID of a SCSI device \r
247 on the SCSI channel. \r
248 Lun - A pointer to the LUN of a SCSI device on \r
249 the SCSI channel. \r
250 Returns:\r
251 EFI_SUCCESS - DevicePath was successfully translated to a \r
252 Target ID and LUN, and they were returned \r
253 in Target and Lun.\r
254 EFI_INVALID_PARAMETER - DevicePath is NULL.\r
255 EFI_INVALID_PARAMETER - Target is NULL.\r
256 EFI_INVALID_PARAMETER - Lun is NULL.\r
257 EFI_UNSUPPORTED - This driver does not support the device path \r
258 node type in DevicePath.\r
259 EFI_NOT_FOUND - A valid translation from DevicePath to a \r
260 Target ID and LUN does not exist.\r
261--*/\r
262;\r
263\r
264typedef\r
265EFI_STATUS\r
266(EFIAPI *EFI_SCSI_PASS_THRU_RESET_CHANNEL) (\r
267 IN EFI_SCSI_PASS_THRU_PROTOCOL * This\r
268 )\r
269/*++\r
270\r
271 Routine Description:\r
272 Resets a SCSI channel.This operation resets all the \r
273 SCSI devices connected to the SCSI channel.\r
274\r
275 Arguments:\r
276 This - Protocol instance pointer.\r
277 \r
278 Returns:\r
279 EFI_SUCCESS - The SCSI channel was reset.\r
280 EFI_UNSUPPORTED - The SCSI channel does not support \r
281 a channel reset operation.\r
282 EFI_DEVICE_ERROR - A device error occurred while \r
283 attempting to reset the SCSI channel.\r
284 EFI_TIMEOUT - A timeout occurred while attempting \r
285 to reset the SCSI channel.\r
286--*/\r
287;\r
288\r
289typedef\r
290EFI_STATUS\r
291(EFIAPI *EFI_SCSI_PASS_THRU_RESET_TARGET) (\r
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
298 Routine Description:\r
299 Resets a SCSI device that is connected to a SCSI channel.\r
300\r
301 Arguments:\r
302 This - Protocol instance pointer.\r
303 Target - The Target ID of the SCSI device to reset. \r
304 Lun - The LUN of the SCSI device to reset.\r
305 \r
306 Returns:\r
307 EFI_SUCCESS - The SCSI device specified by Target and \r
308 Lun was reset.\r
309 EFI_UNSUPPORTED - The SCSI channel does not support a target\r
310 reset operation.\r
311 EFI_INVALID_PARAMETER - Target or Lun are invalid.\r
312 EFI_DEVICE_ERROR - A device error occurred while attempting \r
313 to reset the SCSI device specified by Target \r
314 and Lun.\r
315 EFI_TIMEOUT - A timeout occurred while attempting to reset \r
316 the SCSI device specified by Target and Lun.\r
317--*/\r
318;\r
319\r
e5bce275 320struct _EFI_SCSI_PASS_THRU_PROTOCOL {\r
3eb9473e 321 EFI_SCSI_PASS_THRU_MODE *Mode;\r
322 EFI_SCSI_PASS_THRU_PASSTHRU PassThru;\r
323 EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE GetNextDevice;\r
324 EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;\r
325 EFI_SCSI_PASS_THRU_GET_TARGET_LUN GetTargetLun;\r
326 EFI_SCSI_PASS_THRU_RESET_CHANNEL ResetChannel;\r
327 EFI_SCSI_PASS_THRU_RESET_TARGET ResetTarget;\r
e5bce275 328};\r
3eb9473e 329\r
330extern EFI_GUID gEfiScsiPassThruProtocolGuid;\r
331\r
332#endif\r