]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Library/UefiScsiLib/UefiScsiLib.c
Remove __APPLE__ usage in ProcessorBind.h files.
[mirror_edk2.git] / MdePkg / Library / UefiScsiLib / UefiScsiLib.c
... / ...
CommitLineData
1/** @file\r
2 UEFI SCSI Library implementation\r
3\r
4 Copyright (c) 2006 - 2008, Intel Corporation.<BR>\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**/\r
14\r
15\r
16#include <Uefi.h>\r
17#include <Library/DebugLib.h>\r
18#include <Library/UefiScsiLib.h>\r
19#include <Library/BaseMemoryLib.h>\r
20 \r
21#include <IndustryStandard/Scsi.h>\r
22 \r
23 \r
24 //\r
25 // Max bytes needed to represent ID of a SCSI device\r
26 //\r
27#define EFI_SCSI_TARGET_MAX_BYTES (0x10)\r
28 \r
29 //\r
30 // bit5..7 are for Logical unit number\r
31 // 11100000b (0xe0)\r
32 //\r
33#define EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK 0xe0\r
34 \r
35 //\r
36 // Scsi Command Length six or ten\r
37 //\r
38#define EFI_SCSI_OP_LENGTH_SIX 0x6\r
39#define EFI_SCSI_OP_LENGTH_TEN 0xa\r
40\r
41\r
42\r
43/**\r
44 Execute Test Unit Ready SCSI command on a specific SCSI target.\r
45\r
46 Executes the Test Unit Ready command on the SCSI target specified by ScsiIo.\r
47 If Timeout is zero, then this function waits indefinitely for the command to complete.\r
48 If Timeout is greater than zero, then the command is executed and will timeout after Timeout 100 ns units.\r
49 If ScsiIo is NULL, then ASSERT().\r
50 If SenseDataLength is NULL, then ASSERT().\r
51 If HostAdapterStatus is NULL, then ASSERT().\r
52 If TargetStatus is NULL, then ASSERT().\r
53\r
54\r
55 @param[in] ScsiIo A pointer to the SCSI I/O Protocol instance\r
56 for the specific SCSI target.\r
57 @param[in] Timeout The timeout in 100 ns units to use for the execution\r
58 of this SCSI Request Packet. A Timeout value of\r
59 zero means that this function will wait indefinitely\r
60 for the SCSI Request Packet to execute. If Timeout\r
61 is greater than zero, then this function will return\r
62 EFI_TIMEOUT if the time required to execute the SCSI\r
63 Request Packet is greater than Timeout.\r
64 @param[in, out] SenseData A pointer to sense data that was generated by\r
65 the execution of the SCSI Request Packet. This\r
66 buffer must be allocated by the caller.\r
67 If SenseDataLength is 0, then this parameter is\r
68 optional and may be NULL.\r
69 @param[in, out] SenseDataLength On input, a pointer to the length in bytes of\r
70 the SenseData buffer. On output, a pointer to\r
71 the number of bytes written to the SenseData buffer. \r
72 @param[out] HostAdapterStatus The status of the SCSI Host Controller that produces\r
73 the SCSI bus containing the SCSI target specified by\r
74 ScsiIo when the SCSI Request Packet was executed.\r
75 See the EFI SCSI I/O Protocol in the UEFI Specification\r
76 for details on the possible return values.\r
77 @param[out] TargetStatus The status returned by the SCSI target specified\r
78 by ScsiIo when the SCSI Request Packet was executed\r
79 on the SCSI Host Controller. See the EFI SCSI I/O\r
80 Protocol in the UEFI Specification for details on\r
81 the possible return values. \r
82\r
83 @retval EFI_SUCCESS The command was executed successfully.\r
84 See HostAdapterStatus, TargetStatus, SenseDataLength,\r
85 and SenseData in that order for additional status\r
86 information.\r
87 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because\r
88 there are too many SCSI Command Packets already\r
89 queued. The SCSI Request Packet was not sent, so\r
90 no additional status information is available.\r
91 The caller may retry again later.\r
92 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send\r
93 SCSI Request Packet. See HostAdapterStatus,\r
94 TargetStatus, SenseDataLength, and SenseData in that\r
95 order for additional status information.\r
96 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
97 is not supported by the SCSI initiator(i.e., SCSI\r
98 Host Controller). The SCSI Request Packet was not\r
99 sent, so no additional status information is available.\r
100 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request\r
101 Packet to execute. See HostAdapterStatus, TargetStatus,\r
102 SenseDataLength, and SenseData in that order for\r
103 additional status information.\r
104\r
105**/\r
106EFI_STATUS\r
107EFIAPI\r
108ScsiTestUnitReadyCommand (\r
109 IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
110 IN UINT64 Timeout,\r
111 IN OUT VOID *SenseData, OPTIONAL\r
112 IN OUT UINT8 *SenseDataLength,\r
113 OUT UINT8 *HostAdapterStatus,\r
114 OUT UINT8 *TargetStatus\r
115 )\r
116{\r
117 EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
118 UINT64 Lun;\r
119 UINT8 *Target;\r
120 UINT8 TargetArray[EFI_SCSI_TARGET_MAX_BYTES];\r
121 EFI_STATUS Status;\r
122 UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIX];\r
123\r
124 ASSERT (SenseDataLength != NULL);\r
125 ASSERT (HostAdapterStatus != NULL);\r
126 ASSERT (TargetStatus != NULL);\r
127 ASSERT (ScsiIo != NULL);\r
128\r
129 ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
130 ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIX);\r
131\r
132 CommandPacket.Timeout = Timeout;\r
133 CommandPacket.InDataBuffer = NULL;\r
134 CommandPacket.InTransferLength= 0;\r
135 CommandPacket.OutDataBuffer = NULL;\r
136 CommandPacket.OutTransferLength= 0;\r
137 CommandPacket.SenseData = SenseData;\r
138 CommandPacket.Cdb = Cdb;\r
139 //\r
140 // Fill Cdb for Test Unit Ready Command\r
141 //\r
142 Target = &TargetArray[0];\r
143 ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);\r
144\r
145 Cdb[0] = EFI_SCSI_OP_TEST_UNIT_READY;\r
146 Cdb[1] = (UINT8) ((Lun << 5) & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK);\r
147 CommandPacket.CdbLength = (UINT8) EFI_SCSI_OP_LENGTH_SIX;\r
148 CommandPacket.SenseDataLength = *SenseDataLength;\r
149\r
150 Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);\r
151\r
152 *HostAdapterStatus = CommandPacket.HostAdapterStatus;\r
153 *TargetStatus = CommandPacket.TargetStatus;\r
154 *SenseDataLength = CommandPacket.SenseDataLength;\r
155\r
156 return Status;\r
157}\r
158\r
159\r
160/**\r
161 Execute Inquiry SCSI command on a specific SCSI target.\r
162\r
163 Executes the Inquiry command on the SCSI target specified by ScsiIo.\r
164 If Timeout is zero, then this function waits indefinitely for the command to complete.\r
165 If Timeout is greater than zero, then the command is executed and will timeout after Timeout 100 ns units.\r
166 If ScsiIo is NULL, then ASSERT().\r
167 If SenseDataLength is NULL, then ASSERT().\r
168 If HostAdapterStatus is NULL, then ASSERT().\r
169 If TargetStatus is NULL, then ASSERT().\r
170 If InquiryDataLength is NULL, then ASSERT().\r
171\r
172 @param[in] ScsiIo A pointer to the SCSI I/O Protocol instance\r
173 for the specific SCSI target.\r
174 @param[in] Timeout The timeout in 100 ns units to use for the\r
175 execution of this SCSI Request Packet. A Timeout\r
176 value of zero means that this function will wait\r
177 indefinitely for the SCSI Request Packet to execute.\r
178 If Timeout is greater than zero, then this function\r
179 will return EFI_TIMEOUT if the time required to\r
180 execute the SCSI Request Packet is greater than Timeout.\r
181 @param[in, out] SenseData A pointer to sense data that was generated\r
182 by the execution of the SCSI Request Packet.\r
183 This buffer must be allocated by the caller.\r
184 If SenseDataLength is 0, then this parameter\r
185 is optional and may be NULL.\r
186 @param[in, out] SenseDataLength On input, the length in bytes of the SenseData buffer.\r
187 On output, the number of bytes written to the SenseData buffer. \r
188 @param[out] HostAdapterStatus The status of the SCSI Host Controller that\r
189 produces the SCSI bus containing the SCSI\r
190 target specified by ScsiIo when the SCSI\r
191 Request Packet was executed. See the EFI\r
192 SCSI I/O Protocol in the UEFI Specification\r
193 for details on the possible return values.\r
194 @param[out] TargetStatus The status returned by the SCSI target specified\r
195 by ScsiIo when the SCSI Request Packet was\r
196 executed on the SCSI Host Controller.\r
197 See the EFI SCSI I/O Protocol in the UEFI\r
198 Specification for details on the possible\r
199 return values. \r
200 @param[in, out] InquiryDataBuffer A pointer to inquiry data that was generated\r
201 by the execution of the SCSI Request Packet.\r
202 This buffer must be allocated by the caller.\r
203 If InquiryDataLength is 0, then this parameter\r
204 is optional and may be NULL. \r
205 @param[in, out] InquiryDataLength On input, a pointer to the length in bytes\r
206 of the InquiryDataBuffer buffer.\r
207 On output, a pointer to the number of bytes\r
208 written to the InquiryDataBuffer buffer.\r
209 @param[in] EnableVitalProductData If TRUE, then the supported vital product\r
210 data is returned in InquiryDataBuffer.\r
211 If FALSE, then the standard inquiry data is\r
212 returned in InquiryDataBuffer. \r
213\r
214 @retval EFI_SUCCESS The command was executed successfully. See HostAdapterStatus,\r
215 TargetStatus, SenseDataLength, and SenseData in that order\r
216 for additional status information.\r
217 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the entire\r
218 InquiryDataBuffer could not be transferred. The actual\r
219 number of bytes transferred is returned in InquiryDataLength.\r
220 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there\r
221 are too many SCSI Command Packets already queued.\r
222 The SCSI Request Packet was not sent, so no additional\r
223 status information is available. The caller may retry again later.\r
224 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI\r
225 Request Packet. See HostAdapterStatus, TargetStatus,\r
226 SenseDataLength, and SenseData in that order for additional\r
227 status information.\r
228 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not\r
229 supported by the SCSI initiator(i.e., SCSI Host Controller).\r
230 The SCSI Request Packet was not sent, so no additional\r
231 status information is available.\r
232 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request\r
233 Packet to execute. See HostAdapterStatus, TargetStatus,\r
234 SenseDataLength, and SenseData in that order for\r
235 additional status information.\r
236\r
237**/\r
238EFI_STATUS\r
239EFIAPI\r
240ScsiInquiryCommand (\r
241 IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
242 IN UINT64 Timeout,\r
243 IN OUT VOID *SenseData, OPTIONAL\r
244 IN OUT UINT8 *SenseDataLength,\r
245 OUT UINT8 *HostAdapterStatus,\r
246 OUT UINT8 *TargetStatus,\r
247 IN OUT VOID *InquiryDataBuffer, OPTIONAL\r
248 IN OUT UINT32 *InquiryDataLength,\r
249 IN BOOLEAN EnableVitalProductData\r
250 )\r
251{\r
252 EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
253 UINT64 Lun;\r
254 UINT8 *Target;\r
255 UINT8 TargetArray[EFI_SCSI_TARGET_MAX_BYTES];\r
256 EFI_STATUS Status;\r
257 UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIX];\r
258\r
259 ASSERT (SenseDataLength != NULL);\r
260 ASSERT (HostAdapterStatus != NULL);\r
261 ASSERT (TargetStatus != NULL);\r
262 ASSERT (InquiryDataLength != NULL);\r
263 ASSERT (ScsiIo != NULL);\r
264\r
265 ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
266 ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIX);\r
267\r
268 CommandPacket.Timeout = Timeout;\r
269 CommandPacket.InDataBuffer = InquiryDataBuffer;\r
270 CommandPacket.InTransferLength= *InquiryDataLength;\r
271 CommandPacket.SenseData = SenseData;\r
272 CommandPacket.SenseDataLength = *SenseDataLength;\r
273 CommandPacket.Cdb = Cdb;\r
274\r
275 Target = &TargetArray[0];\r
276 ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);\r
277\r
278 Cdb[0] = EFI_SCSI_OP_INQUIRY;\r
279 Cdb[1] = (UINT8) ((Lun << 5) & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK);\r
280 if (EnableVitalProductData) {\r
281 Cdb[1] |= 0x01;\r
282 }\r
283\r
284 if (*InquiryDataLength > 0xff) {\r
285 *InquiryDataLength = 0xff;\r
286 }\r
287\r
288 Cdb[4] = (UINT8) (*InquiryDataLength);\r
289 CommandPacket.CdbLength = (UINT8) EFI_SCSI_OP_LENGTH_SIX;\r
290 CommandPacket.DataDirection = EFI_SCSI_DATA_IN;\r
291\r
292 Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);\r
293\r
294 *HostAdapterStatus = CommandPacket.HostAdapterStatus;\r
295 *TargetStatus = CommandPacket.TargetStatus;\r
296 *SenseDataLength = CommandPacket.SenseDataLength;\r
297 *InquiryDataLength = CommandPacket.InTransferLength;\r
298\r
299 return Status;\r
300}\r
301\r
302\r
303/**\r
304 Execute Mode Sense(10) SCSI command on a specific SCSI target.\r
305\r
306 Executes the SCSI Mode Sense(10) command on the SCSI target specified by ScsiIo.\r
307 If Timeout is zero, then this function waits indefinitely for the command to complete.\r
308 If Timeout is greater than zero, then the command is executed and will timeout\r
309 after Timeout 100 ns units. The DBDField, PageControl, and PageCode parameters\r
310 are used to construct the CDB for this SCSI command.\r
311 If ScsiIo is NULL, then ASSERT().\r
312 If SenseDataLength is NULL, then ASSERT().\r
313 If HostAdapterStatus is NULL, then ASSERT().\r
314 If TargetStatus is NULL, then ASSERT().\r
315 If DataLength is NULL, then ASSERT().\r
316\r
317\r
318 @param[in] ScsiIo A pointer to the SCSI I/O Protocol instance\r
319 for the specific SCSI target.\r
320 @param[in] Timeout The timeout in 100 ns units to use for the\r
321 execution of this SCSI Request Packet. A Timeout\r
322 value of zero means that this function will wait\r
323 indefinitely for the SCSI Request Packet to execute.\r
324 If Timeout is greater than zero, then this function\r
325 will return EFI_TIMEOUT if the time required to\r
326 execute the SCSI Request Packet is greater than Timeout.\r
327 @param[in, out] SenseData A pointer to sense data that was generated\r
328 by the execution of the SCSI Request Packet.\r
329 This buffer must be allocated by the caller.\r
330 If SenseDataLength is 0, then this parameter\r
331 is optional and may be NULL.\r
332 @param[in, out] SenseDataLength On input, the length in bytes of the SenseData buffer.\r
333 On output, the number of bytes written to the SenseData buffer. \r
334 @param[out] HostAdapterStatus The status of the SCSI Host Controller that\r
335 produces the SCSI bus containing the SCSI target\r
336 specified by ScsiIo when the SCSI Request Packet\r
337 was executed. See the EFI SCSI I/O Protocol in the\r
338 UEFI Specification for details on the possible\r
339 return values.\r
340 @param[out] TargetStatus The status returned by the SCSI target specified\r
341 by ScsiIo when the SCSI Request Packet was executed\r
342 on the SCSI Host Controller. See the EFI SCSI\r
343 I/O Protocol in the UEFI Specification for details\r
344 on the possible return values.\r
345 @param[in, out] DataBuffer A pointer to data that was generated by the\r
346 execution of the SCSI Request Packet. This\r
347 buffer must be allocated by the caller. If\r
348 DataLength is 0, then this parameter is optional\r
349 and may be NULL. \r
350 @param[in, out] DataLength On input, a pointer to the length in bytes of\r
351 the DataBuffer buffer. On output, a pointer\r
352 to the number of bytes written to the DataBuffer\r
353 buffer. \r
354 @param[in] DBDField Specifies the DBD field of the CDB for this SCSI Command.\r
355 @param[in] PageControl Specifies the PC field of the CDB for this SCSI Command. \r
356 @param[in] PageCode Specifies the Page Control field of the CDB for this SCSI Command. \r
357\r
358 @retval EFI_SUCCESS The command was executed successfully.\r
359 See HostAdapterStatus, TargetStatus, SenseDataLength,\r
360 and SenseData in that order for additional status information.\r
361 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the\r
362 entire DataBuffer could not be transferred.\r
363 The actual number of bytes transferred is returned\r
364 in DataLength.\r
365 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because\r
366 there are too many SCSI Command Packets already queued.\r
367 The SCSI Request Packet was not sent, so no additional\r
368 status information is available. The caller may retry\r
369 again later.\r
370 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send\r
371 SCSI Request Packet. See HostAdapterStatus, TargetStatus,\r
372 SenseDataLength, and SenseData in that order for\r
373 additional status information.\r
374 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
375 is not supported by the SCSI initiator(i.e., SCSI\r
376 Host Controller). The SCSI Request Packet was not\r
377 sent, so no additional status information is available.\r
378 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI\r
379 Request Packet to execute. See HostAdapterStatus,\r
380 TargetStatus, SenseDataLength, and SenseData in that\r
381 order for additional status information.\r
382\r
383**/\r
384EFI_STATUS\r
385EFIAPI\r
386ScsiModeSense10Command (\r
387 IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
388 IN UINT64 Timeout,\r
389 IN OUT VOID *SenseData, OPTIONAL\r
390 IN OUT UINT8 *SenseDataLength,\r
391 OUT UINT8 *HostAdapterStatus,\r
392 OUT UINT8 *TargetStatus,\r
393 IN OUT VOID *DataBuffer, OPTIONAL\r
394 IN OUT UINT32 *DataLength,\r
395 IN UINT8 DBDField, OPTIONAL\r
396 IN UINT8 PageControl,\r
397 IN UINT8 PageCode\r
398 )\r
399{\r
400 EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
401 UINT64 Lun;\r
402 UINT8 *Target;\r
403 UINT8 TargetArray[EFI_SCSI_TARGET_MAX_BYTES];\r
404 EFI_STATUS Status;\r
405 UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN];\r
406\r
407 ASSERT (SenseDataLength != NULL);\r
408 ASSERT (HostAdapterStatus != NULL);\r
409 ASSERT (TargetStatus != NULL);\r
410 ASSERT (DataLength != NULL);\r
411 ASSERT (ScsiIo != NULL);\r
412\r
413 ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
414 ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);\r
415\r
416 CommandPacket.Timeout = Timeout;\r
417 CommandPacket.InDataBuffer = DataBuffer;\r
418 CommandPacket.SenseData = SenseData;\r
419 CommandPacket.InTransferLength= *DataLength;\r
420 CommandPacket.Cdb = Cdb;\r
421 //\r
422 // Fill Cdb for Mode Sense (10) Command\r
423 //\r
424 Target = &TargetArray[0];\r
425 ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);\r
426\r
427 Cdb[0] = EFI_SCSI_OP_MODE_SEN10;\r
428 //\r
429 // DBDField is in Cdb[1] bit3 of (bit7..0)\r
430 //\r
431 Cdb[1] = (UINT8) (((Lun << 5) & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK) + ((DBDField << 3) & 0x08));\r
432 //\r
433 // PageControl is in Cdb[2] bit7..6, PageCode is in Cdb[2] bit5..0\r
434 //\r
435 Cdb[2] = (UINT8) (((PageControl << 6) & 0xc0) | (PageCode & 0x3f));\r
436 Cdb[7] = (UINT8) (*DataLength >> 8);\r
437 Cdb[8] = (UINT8) (*DataLength);\r
438\r
439 CommandPacket.CdbLength = EFI_SCSI_OP_LENGTH_TEN;\r
440 CommandPacket.DataDirection = EFI_SCSI_DATA_IN;\r
441 CommandPacket.SenseDataLength = *SenseDataLength;\r
442\r
443 Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);\r
444\r
445 *HostAdapterStatus = CommandPacket.HostAdapterStatus;\r
446 *TargetStatus = CommandPacket.TargetStatus;\r
447 *SenseDataLength = CommandPacket.SenseDataLength;\r
448 *DataLength = CommandPacket.InTransferLength;\r
449\r
450 return Status;\r
451}\r
452\r
453\r
454/**\r
455 Execute Request Sense SCSI command on a specific SCSI target.\r
456\r
457 Executes the Request Sense command on the SCSI target specified by ScsiIo.\r
458 If Timeout is zero, then this function waits indefinitely for the command to complete.\r
459 If Timeout is greater than zero, then the command is executed and will timeout after Timeout 100 ns units.\r
460 If ScsiIo is NULL, then ASSERT().\r
461 If SenseDataLength is NULL, then ASSERT().\r
462 If HostAdapterStatus is NULL, then ASSERT().\r
463 If TargetStatus is NULL, then ASSERT().\r
464\r
465 @param[in] ScsiIo A pointer to SCSI IO protocol.\r
466 @param[in] Timeout The length of timeout period.\r
467 @param[in, out] SenseData A pointer to output sense data.\r
468 @param[in, out] SenseDataLength The length of output sense data.\r
469 @param[out] HostAdapterStatus The status of Host Adapter.\r
470 @param[out] TargetStatus The status of the target.\r
471\r
472 @retval EFI_SUCCESS Command is executed successfully.\r
473 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are\r
474 too many SCSI Command Packets already queued.\r
475 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI Request Packet.\r
476 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by\r
477 the SCSI initiator(i.e., SCSI Host Controller)\r
478 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.\r
479\r
480**/\r
481EFI_STATUS\r
482EFIAPI\r
483ScsiRequestSenseCommand (\r
484 IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
485 IN UINT64 Timeout,\r
486 IN OUT VOID *SenseData, OPTIONAL\r
487 IN OUT UINT8 *SenseDataLength,\r
488 OUT UINT8 *HostAdapterStatus,\r
489 OUT UINT8 *TargetStatus\r
490 )\r
491{\r
492 EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
493 UINT64 Lun;\r
494 UINT8 *Target;\r
495 UINT8 TargetArray[EFI_SCSI_TARGET_MAX_BYTES];\r
496 EFI_STATUS Status;\r
497 UINT8 Cdb[EFI_SCSI_OP_LENGTH_SIX];\r
498\r
499 ASSERT (SenseDataLength != NULL);\r
500 ASSERT (HostAdapterStatus != NULL);\r
501 ASSERT (TargetStatus != NULL);\r
502 ASSERT (ScsiIo != NULL);\r
503\r
504 ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
505 ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIX);\r
506\r
507 CommandPacket.Timeout = Timeout;\r
508 CommandPacket.InDataBuffer = SenseData;\r
509 CommandPacket.SenseData = NULL;\r
510 CommandPacket.InTransferLength= *SenseDataLength;\r
511 CommandPacket.Cdb = Cdb;\r
512 //\r
513 // Fill Cdb for Request Sense Command\r
514 //\r
515 Target = &TargetArray[0];\r
516 ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);\r
517\r
518 Cdb[0] = EFI_SCSI_OP_REQUEST_SENSE;\r
519 Cdb[1] = (UINT8) ((Lun << 5) & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK);\r
520 Cdb[4] = (UINT8) (*SenseDataLength);\r
521\r
522 CommandPacket.CdbLength = (UINT8) EFI_SCSI_OP_LENGTH_SIX;\r
523 CommandPacket.DataDirection = EFI_SCSI_DATA_IN;\r
524 CommandPacket.SenseDataLength = 0;\r
525\r
526 Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);\r
527\r
528 *HostAdapterStatus = CommandPacket.HostAdapterStatus;\r
529 *TargetStatus = CommandPacket.TargetStatus;\r
530 *SenseDataLength = (UINT8) CommandPacket.InTransferLength;\r
531\r
532 return Status;\r
533}\r
534\r
535\r
536/**\r
537 Execute Read Capacity SCSI command on a specific SCSI target.\r
538\r
539 Executes the SCSI Read Capacity command on the SCSI target specified by ScsiIo.\r
540 If Timeout is zero, then this function waits indefinitely for the command to complete.\r
541 If Timeout is greater than zero, then the command is executed and will timeout after\r
542 Timeout 100 ns units. The Pmi parameter is used to construct the CDB for this SCSI command.\r
543 If ScsiIo is NULL, then ASSERT().\r
544 If SenseDataLength is NULL, then ASSERT().\r
545 If HostAdapterStatus is NULL, then ASSERT().\r
546 If TargetStatus is NULL, then ASSERT().\r
547 If DataLength is NULL, then ASSERT().\r
548\r
549 @param[in] ScsiIo A pointer to SCSI IO protocol.\r
550 @param[in] Timeout The length of timeout period.\r
551 @param[in, out] SenseData A pointer to output sense data.\r
552 @param[in, out] SenseDataLength The length of output sense data.\r
553 @param[out] HostAdapterStatus The status of Host Adapter.\r
554 @param[out] TargetStatus The status of the target.\r
555 @param[in, out] DataBuffer A pointer to a data buffer.\r
556 @param[in, out] DataLength The length of data buffer.\r
557 @param[in] Pmi Partial medium indicator.\r
558\r
559 @retval EFI_SUCCESS Command is executed successfully.\r
560 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the entire\r
561 DataBuffer could not be transferred. The actual\r
562 number of bytes transferred is returned in DataLength.\r
563 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because\r
564 there are too many SCSI Command Packets already queued.\r
565 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI Request Packet.\r
566 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
567 is not supported by the SCSI initiator(i.e., SCSI Host Controller)\r
568 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.\r
569\r
570**/\r
571EFI_STATUS\r
572EFIAPI\r
573ScsiReadCapacityCommand (\r
574 IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
575 IN UINT64 Timeout,\r
576 IN OUT VOID *SenseData, OPTIONAL\r
577 IN OUT UINT8 *SenseDataLength,\r
578 OUT UINT8 *HostAdapterStatus,\r
579 OUT UINT8 *TargetStatus,\r
580 IN OUT VOID *DataBuffer, OPTIONAL\r
581 IN OUT UINT32 *DataLength,\r
582 IN BOOLEAN Pmi\r
583 )\r
584{\r
585 EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
586 UINT64 Lun;\r
587 UINT8 *Target;\r
588 UINT8 TargetArray[EFI_SCSI_TARGET_MAX_BYTES];\r
589 EFI_STATUS Status;\r
590 UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN];\r
591\r
592 ASSERT (SenseDataLength != NULL);\r
593 ASSERT (HostAdapterStatus != NULL);\r
594 ASSERT (TargetStatus != NULL);\r
595 ASSERT (DataLength != NULL);\r
596 ASSERT (ScsiIo != NULL);\r
597\r
598 ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
599 ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);\r
600\r
601 CommandPacket.Timeout = Timeout;\r
602 CommandPacket.InDataBuffer = DataBuffer;\r
603 CommandPacket.SenseData = SenseData;\r
604 CommandPacket.InTransferLength= *DataLength;\r
605 CommandPacket.Cdb = Cdb;\r
606 //\r
607 // Fill Cdb for Read Capacity Command\r
608 //\r
609 Target = &TargetArray[0];\r
610 ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);\r
611\r
612 Cdb[0] = EFI_SCSI_OP_READ_CAPACITY;\r
613 Cdb[1] = (UINT8) ((Lun << 5) & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK);\r
614 if (!Pmi) {\r
615 //\r
616 // Partial medium indicator,if Pmi is FALSE, the Cdb.2 ~ Cdb.5 MUST BE ZERO.\r
617 //\r
618 ZeroMem ((Cdb + 2), 4);\r
619 } else {\r
620 Cdb[8] |= 0x01;\r
621 }\r
622\r
623 CommandPacket.CdbLength = EFI_SCSI_OP_LENGTH_TEN;\r
624 CommandPacket.DataDirection = EFI_SCSI_DATA_IN;\r
625 CommandPacket.SenseDataLength = *SenseDataLength;\r
626\r
627 Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);\r
628\r
629 *HostAdapterStatus = CommandPacket.HostAdapterStatus;\r
630 *TargetStatus = CommandPacket.TargetStatus;\r
631 *SenseDataLength = CommandPacket.SenseDataLength;\r
632 *DataLength = CommandPacket.InTransferLength;\r
633\r
634 return Status;\r
635}\r
636\r
637\r
638/**\r
639 Execute Read Capacity SCSI 16 command on a specific SCSI target.\r
640\r
641 Executes the SCSI Read Capacity 16 command on the SCSI target specified by ScsiIo.\r
642 If Timeout is zero, then this function waits indefinitely for the command to complete.\r
643 If Timeout is greater than zero, then the command is executed and will timeout after\r
644 Timeout 100 ns units. The Pmi parameter is used to construct the CDB for this SCSI command.\r
645 If ScsiIo is NULL, then ASSERT().\r
646 If SenseDataLength is NULL, then ASSERT().\r
647 If HostAdapterStatus is NULL, then ASSERT().\r
648 If TargetStatus is NULL, then ASSERT().\r
649 If DataLength is NULL, then ASSERT().\r
650\r
651 @param[in] ScsiIo A pointer to SCSI IO protocol.\r
652 @param[in] Timeout The length of timeout period.\r
653 @param[in, out] SenseData A pointer to output sense data.\r
654 @param[in, out] SenseDataLength The length of output sense data.\r
655 @param[out] HostAdapterStatus The status of Host Adapter.\r
656 @param[out] TargetStatus The status of the target.\r
657 @param[in, out] DataBuffer A pointer to a data buffer.\r
658 @param[in, out] DataLength The length of data buffer.\r
659 @param[in] Pmi Partial medium indicator.\r
660\r
661 @retval EFI_SUCCESS Command is executed successfully.\r
662 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the entire\r
663 DataBuffer could not be transferred. The actual\r
664 number of bytes transferred is returned in DataLength.\r
665 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because\r
666 there are too many SCSI Command Packets already queued.\r
667 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI Request Packet.\r
668 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
669 is not supported by the SCSI initiator(i.e., SCSI Host Controller)\r
670 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.\r
671\r
672**/\r
673EFI_STATUS\r
674EFIAPI\r
675ScsiReadCapacity16Command (\r
676 IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
677 IN UINT64 Timeout,\r
678 IN OUT VOID *SenseData, OPTIONAL\r
679 IN OUT UINT8 *SenseDataLength,\r
680 OUT UINT8 *HostAdapterStatus,\r
681 OUT UINT8 *TargetStatus,\r
682 IN OUT VOID *DataBuffer, OPTIONAL\r
683 IN OUT UINT32 *DataLength,\r
684 IN BOOLEAN Pmi\r
685 )\r
686{\r
687 EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
688 UINT64 Lun;\r
689 UINT8 *Target;\r
690 UINT8 TargetArray[EFI_SCSI_TARGET_MAX_BYTES];\r
691 EFI_STATUS Status;\r
692 UINT8 Cdb[16];\r
693\r
694 ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
695 ZeroMem (Cdb, 16);\r
696\r
697 CommandPacket.Timeout = Timeout;\r
698 CommandPacket.InDataBuffer = DataBuffer;\r
699 CommandPacket.SenseData = SenseData;\r
700 CommandPacket.InTransferLength= *DataLength;\r
701 CommandPacket.Cdb = Cdb;\r
702 //\r
703 // Fill Cdb for Read Capacity Command\r
704 //\r
705 Target = &TargetArray[0];\r
706 ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);\r
707\r
708 Cdb[0] = EFI_SCSI_OP_READ_CAPACITY16;\r
709 Cdb[1] = 0x10;\r
710 if (!Pmi) {\r
711 //\r
712 // Partial medium indicator,if Pmi is FALSE, the Cdb.2 ~ Cdb.9 MUST BE ZERO.\r
713 //\r
714 ZeroMem ((Cdb + 2), 8);\r
715 } else {\r
716 Cdb[14] |= 0x01;\r
717 }\r
718\r
719 Cdb[13] = 0x20;\r
720 CommandPacket.CdbLength = 16;\r
721 CommandPacket.DataDirection = EFI_SCSI_DATA_IN;\r
722 CommandPacket.SenseDataLength = *SenseDataLength;\r
723\r
724 Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);\r
725\r
726 *HostAdapterStatus = CommandPacket.HostAdapterStatus;\r
727 *TargetStatus = CommandPacket.TargetStatus;\r
728 *SenseDataLength = CommandPacket.SenseDataLength;\r
729 *DataLength = CommandPacket.InTransferLength;\r
730\r
731 return Status;\r
732}\r
733\r
734\r
735/**\r
736 Execute Read(10) SCSI command on a specific SCSI target.\r
737\r
738 Executes the SCSI Read(10) command on the SCSI target specified by ScsiIo.\r
739 If Timeout is zero, then this function waits indefinitely for the command to complete.\r
740 If Timeout is greater than zero, then the command is executed and will timeout\r
741 after Timeout 100 ns units. The StartLba and SectorSize parameters are used to\r
742 construct the CDB for this SCSI command.\r
743 If ScsiIo is NULL, then ASSERT().\r
744 If SenseDataLength is NULL, then ASSERT().\r
745 If HostAdapterStatus is NULL, then ASSERT().\r
746 If TargetStatus is NULL, then ASSERT().\r
747 If DataLength is NULL, then ASSERT().\r
748\r
749\r
750 @param[in] ScsiIo A pointer to SCSI IO protocol.\r
751 @param[in] Timeout The length of timeout period.\r
752 @param[in, out] SenseData A pointer to output sense data.\r
753 @param[in, out] SenseDataLength The length of output sense data.\r
754 @param[out] HostAdapterStatus The status of Host Adapter.\r
755 @param[out] TargetStatus The status of the target.\r
756 @param[in, out] DataBuffer Read 10 command data.\r
757 @param[in, out] DataLength The length of data buffer.\r
758 @param[in] StartLba The start address of LBA.\r
759 @param[in] SectorSize The sector size.\r
760\r
761 @retval EFI_SUCCESS Command is executed successfully.\r
762 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the entire DataBuffer could\r
763 not be transferred. The actual number of bytes transferred is returned in DataLength.\r
764 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many \r
765 SCSI Command Packets already queued.\r
766 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI Request Packet.\r
767 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by \r
768 the SCSI initiator(i.e., SCSI Host Controller)\r
769 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.\r
770\r
771**/\r
772EFI_STATUS\r
773EFIAPI\r
774ScsiRead10Command (\r
775 IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
776 IN UINT64 Timeout,\r
777 IN OUT VOID *SenseData, OPTIONAL\r
778 IN OUT UINT8 *SenseDataLength,\r
779 OUT UINT8 *HostAdapterStatus,\r
780 OUT UINT8 *TargetStatus,\r
781 IN OUT VOID *DataBuffer, OPTIONAL\r
782 IN OUT UINT32 *DataLength,\r
783 IN UINT32 StartLba,\r
784 IN UINT32 SectorSize\r
785 )\r
786{\r
787 EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
788 UINT64 Lun;\r
789 UINT8 *Target;\r
790 UINT8 TargetArray[EFI_SCSI_TARGET_MAX_BYTES];\r
791 EFI_STATUS Status;\r
792 UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN];\r
793\r
794 ASSERT (SenseDataLength != NULL);\r
795 ASSERT (HostAdapterStatus != NULL);\r
796 ASSERT (TargetStatus != NULL);\r
797 ASSERT (DataLength != NULL);\r
798 ASSERT (ScsiIo != NULL);\r
799\r
800 ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
801 ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);\r
802\r
803 CommandPacket.Timeout = Timeout;\r
804 CommandPacket.InDataBuffer = DataBuffer;\r
805 CommandPacket.SenseData = SenseData;\r
806 CommandPacket.InTransferLength= *DataLength;\r
807 CommandPacket.Cdb = Cdb;\r
808 //\r
809 // Fill Cdb for Read (10) Command\r
810 //\r
811 Target = &TargetArray[0];\r
812 ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);\r
813\r
814 Cdb[0] = EFI_SCSI_OP_READ10;\r
815 Cdb[1] = (UINT8) ((Lun << 5) & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK);\r
816 Cdb[2] = (UINT8) (StartLba >> 24);\r
817 Cdb[3] = (UINT8) (StartLba >> 16);\r
818 Cdb[4] = (UINT8) (StartLba >> 8);\r
819 Cdb[5] = (UINT8) (StartLba & 0xff);\r
820 Cdb[7] = (UINT8) (SectorSize >> 8);\r
821 Cdb[8] = (UINT8) (SectorSize & 0xff);\r
822\r
823 CommandPacket.CdbLength = EFI_SCSI_OP_LENGTH_TEN;\r
824 CommandPacket.DataDirection = EFI_SCSI_DATA_IN;\r
825 CommandPacket.SenseDataLength = *SenseDataLength;\r
826\r
827 Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);\r
828\r
829 *HostAdapterStatus = CommandPacket.HostAdapterStatus;\r
830 *TargetStatus = CommandPacket.TargetStatus;\r
831 *SenseDataLength = CommandPacket.SenseDataLength;\r
832 *DataLength = CommandPacket.InTransferLength;\r
833\r
834 return Status;\r
835}\r
836\r
837\r
838/**\r
839 Execute Write(10) SCSI command on a specific SCSI target.\r
840\r
841 Executes the SCSI Write(10) command on the SCSI target specified by ScsiIo.\r
842 If Timeout is zero, then this function waits indefinitely for the command to complete.\r
843 If Timeout is greater than zero, then the command is executed and will timeout after\r
844 Timeout 100 ns units. The StartLba and SectorSize parameters are used to construct\r
845 the CDB for this SCSI command.\r
846 If ScsiIo is NULL, then ASSERT().\r
847 If SenseDataLength is NULL, then ASSERT().\r
848 If HostAdapterStatus is NULL, then ASSERT().\r
849 If TargetStatus is NULL, then ASSERT().\r
850 If DataLength is NULL, then ASSERT().\r
851\r
852 @param[in] ScsiIo SCSI IO Protocol to use\r
853 @param[in] Timeout The length of timeout period.\r
854 @param[in, out] SenseData A pointer to output sense data.\r
855 @param[in, out] SenseDataLength The length of output sense data.\r
856 @param[out] HostAdapterStatus The status of Host Adapter.\r
857 @param[out] TargetStatus The status of the target.\r
858 @param[in, out] DataBuffer A pointer to a data buffer.\r
859 @param[in, out] DataLength The length of data buffer.\r
860 @param[in] StartLba The start address of LBA.\r
861 @param[in] SectorSize The sector size.\r
862\r
863 @retval EFI_SUCCESS Command is executed successfully.\r
864 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the entire DataBuffer could\r
865 not be transferred. The actual number of bytes transferred is returned in DataLength.\r
866 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many \r
867 SCSI Command Packets already queued.\r
868 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send SCSI Request Packet.\r
869 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by \r
870 the SCSI initiator(i.e., SCSI Host Controller)\r
871 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.\r
872\r
873**/\r
874EFI_STATUS\r
875EFIAPI\r
876ScsiWrite10Command (\r
877 IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
878 IN UINT64 Timeout,\r
879 IN OUT VOID *SenseData, OPTIONAL\r
880 IN OUT UINT8 *SenseDataLength,\r
881 OUT UINT8 *HostAdapterStatus,\r
882 OUT UINT8 *TargetStatus,\r
883 IN OUT VOID *DataBuffer, OPTIONAL\r
884 IN OUT UINT32 *DataLength,\r
885 IN UINT32 StartLba,\r
886 IN UINT32 SectorSize\r
887 )\r
888{\r
889 EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
890 UINT64 Lun;\r
891 UINT8 *Target;\r
892 UINT8 TargetArray[EFI_SCSI_TARGET_MAX_BYTES];\r
893 EFI_STATUS Status;\r
894 UINT8 Cdb[EFI_SCSI_OP_LENGTH_TEN];\r
895\r
896 ASSERT (SenseDataLength != NULL);\r
897 ASSERT (HostAdapterStatus != NULL);\r
898 ASSERT (TargetStatus != NULL);\r
899 ASSERT (DataLength != NULL);\r
900 ASSERT (ScsiIo != NULL);\r
901\r
902 ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
903 ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);\r
904\r
905 CommandPacket.Timeout = Timeout;\r
906 CommandPacket.OutDataBuffer = DataBuffer;\r
907 CommandPacket.SenseData = SenseData;\r
908 CommandPacket.OutTransferLength= *DataLength;\r
909 CommandPacket.Cdb = Cdb;\r
910 //\r
911 // Fill Cdb for Write (10) Command\r
912 //\r
913 Target = &TargetArray[0];\r
914 ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);\r
915\r
916 Cdb[0] = EFI_SCSI_OP_WRITE10;\r
917 Cdb[1] = (UINT8) ((Lun << 5) & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK);\r
918 Cdb[2] = (UINT8) (StartLba >> 24);\r
919 Cdb[3] = (UINT8) (StartLba >> 16);\r
920 Cdb[4] = (UINT8) (StartLba >> 8);\r
921 Cdb[5] = (UINT8) StartLba;\r
922 Cdb[7] = (UINT8) (SectorSize >> 8);\r
923 Cdb[8] = (UINT8) SectorSize;\r
924\r
925 CommandPacket.CdbLength = EFI_SCSI_OP_LENGTH_TEN;\r
926 CommandPacket.DataDirection = EFI_SCSI_DATA_OUT;\r
927 CommandPacket.SenseDataLength = *SenseDataLength;\r
928\r
929 Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);\r
930\r
931 *HostAdapterStatus = CommandPacket.HostAdapterStatus;\r
932 *TargetStatus = CommandPacket.TargetStatus;\r
933 *SenseDataLength = CommandPacket.SenseDataLength;\r
934 *DataLength = CommandPacket.OutTransferLength;\r
935\r
936 return Status;\r
937}\r
938\r