]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiTcp4Io.h:
[mirror_edk2.git] / MdeModulePkg / Bus / Scsi / ScsiDiskDxe / ScsiDisk.h
CommitLineData
6ad55b15 1/*++\r
2\r
9cb8724d 3Copyright (c) 2004 - 2008, Intel Corporation \r
6ad55b15 4All rights reserved. This program and the accompanying materials \r
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 ScsiDisk.h\r
15\r
16Abstract:\r
17 \r
18 Header file for SCSI Disk Driver.\r
19\r
20--*/\r
21\r
22#ifndef _SCSI_DISK_H\r
23#define _SCSI_DISK_H\r
24\r
25\r
9cb8724d 26#include <IndustryStandard/Scsi.h>\r
6ad55b15 27\r
28#define IsDeviceFixed(a) (a)->FixedDevice ? 1 : 0\r
29\r
30#define SCSI_DISK_DEV_SIGNATURE EFI_SIGNATURE_32 ('s', 'c', 'd', 'k')\r
31\r
32typedef struct {\r
33 UINT32 Signature;\r
34\r
35 EFI_HANDLE Handle;\r
36\r
37 EFI_BLOCK_IO_PROTOCOL BlkIo;\r
38 EFI_BLOCK_IO_MEDIA BlkIoMedia;\r
39 EFI_SCSI_IO_PROTOCOL *ScsiIo;\r
40 UINT8 DeviceType;\r
41 BOOLEAN FixedDevice;\r
42 UINT16 Reserved;\r
43\r
44 EFI_SCSI_SENSE_DATA *SenseData;\r
45 UINTN SenseDataNumber;\r
46 EFI_SCSI_INQUIRY_DATA InquiryData;\r
47\r
48 EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
49\r
50} SCSI_DISK_DEV;\r
51\r
52#define SCSI_DISK_DEV_FROM_THIS(a) CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)\r
53\r
54//\r
55// Global Variables\r
56//\r
70da5bc2 57extern EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding;\r
58extern EFI_COMPONENT_NAME_PROTOCOL gScsiDiskComponentName;\r
59extern EFI_COMPONENT_NAME2_PROTOCOL gScsiDiskComponentName2;\r
6ad55b15 60//\r
61// action code used in detect media process\r
62//\r
63#define ACTION_NO_ACTION 0x00\r
64#define ACTION_READ_CAPACITY 0x01\r
65#define ACTION_RETRY_COMMAND_LATER 0x02\r
66\r
67EFI_STATUS\r
68EFIAPI\r
69ScsiDiskDriverBindingSupported (\r
70 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
71 IN EFI_HANDLE Controller,\r
72 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
73 );\r
74\r
75EFI_STATUS\r
76EFIAPI\r
77ScsiDiskDriverBindingStart (\r
78 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
79 IN EFI_HANDLE Controller,\r
80 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
81 );\r
82\r
83EFI_STATUS\r
84EFIAPI\r
85ScsiDiskDriverBindingStop (\r
86 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
87 IN EFI_HANDLE Controller,\r
88 IN UINTN NumberOfChildren,\r
89 IN EFI_HANDLE *ChildHandleBuffer\r
90 );\r
91\r
92//\r
93// EFI Component Name Functions\r
94//\r
70da5bc2 95/**\r
96 Retrieves a Unicode string that is the user readable name of the driver.\r
97\r
98 This function retrieves the user readable name of a driver in the form of a\r
99 Unicode string. If the driver specified by This has a user readable name in\r
100 the language specified by Language, then a pointer to the driver name is\r
101 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
102 by This does not support the language specified by Language,\r
103 then EFI_UNSUPPORTED is returned.\r
104\r
105 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
106 EFI_COMPONENT_NAME_PROTOCOL instance.\r
107\r
108 @param Language[in] A pointer to a Null-terminated ASCII string\r
109 array indicating the language. This is the\r
110 language of the driver name that the caller is\r
111 requesting, and it must match one of the\r
112 languages specified in SupportedLanguages. The\r
113 number of languages supported by a driver is up\r
114 to the driver writer. Language is specified\r
115 in RFC 3066 or ISO 639-2 language code format.\r
116\r
117 @param DriverName[out] A pointer to the Unicode string to return.\r
118 This Unicode string is the name of the\r
119 driver specified by This in the language\r
120 specified by Language.\r
121\r
122 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
123 This and the language specified by Language was\r
124 returned in DriverName.\r
125\r
126 @retval EFI_INVALID_PARAMETER Language is NULL.\r
127\r
128 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
129\r
130 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
131 the language specified by Language.\r
132\r
133**/\r
6ad55b15 134EFI_STATUS\r
135EFIAPI\r
136ScsiDiskComponentNameGetDriverName (\r
137 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
138 IN CHAR8 *Language,\r
139 OUT CHAR16 **DriverName\r
140 );\r
141\r
70da5bc2 142\r
143/**\r
144 Retrieves a Unicode string that is the user readable name of the controller\r
145 that is being managed by a driver.\r
146\r
147 This function retrieves the user readable name of the controller specified by\r
148 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
149 driver specified by This has a user readable name in the language specified by\r
150 Language, then a pointer to the controller name is returned in ControllerName,\r
151 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
152 managing the controller specified by ControllerHandle and ChildHandle,\r
153 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
154 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
155\r
156 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
157 EFI_COMPONENT_NAME_PROTOCOL instance.\r
158\r
159 @param ControllerHandle[in] The handle of a controller that the driver\r
160 specified by This is managing. This handle\r
161 specifies the controller whose name is to be\r
162 returned.\r
163\r
164 @param ChildHandle[in] The handle of the child controller to retrieve\r
165 the name of. This is an optional parameter that\r
166 may be NULL. It will be NULL for device\r
167 drivers. It will also be NULL for a bus drivers\r
168 that wish to retrieve the name of the bus\r
169 controller. It will not be NULL for a bus\r
170 driver that wishes to retrieve the name of a\r
171 child controller.\r
172\r
173 @param Language[in] A pointer to a Null-terminated ASCII string\r
174 array indicating the language. This is the\r
175 language of the driver name that the caller is\r
176 requesting, and it must match one of the\r
177 languages specified in SupportedLanguages. The\r
178 number of languages supported by a driver is up\r
179 to the driver writer. Language is specified in\r
180 RFC 3066 or ISO 639-2 language code format.\r
181\r
182 @param ControllerName[out] A pointer to the Unicode string to return.\r
183 This Unicode string is the name of the\r
184 controller specified by ControllerHandle and\r
185 ChildHandle in the language specified by\r
186 Language from the point of view of the driver\r
187 specified by This.\r
188\r
189 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
190 the language specified by Language for the\r
191 driver specified by This was returned in\r
192 DriverName.\r
193\r
194 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
195\r
196 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
197 EFI_HANDLE.\r
198\r
199 @retval EFI_INVALID_PARAMETER Language is NULL.\r
200\r
201 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
202\r
203 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
204 managing the controller specified by\r
205 ControllerHandle and ChildHandle.\r
206\r
207 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
208 the language specified by Language.\r
209\r
210**/\r
6ad55b15 211EFI_STATUS\r
212EFIAPI\r
213ScsiDiskComponentNameGetControllerName (\r
214 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
215 IN EFI_HANDLE ControllerHandle,\r
216 IN EFI_HANDLE ChildHandle OPTIONAL,\r
217 IN CHAR8 *Language,\r
218 OUT CHAR16 **ControllerName\r
219 );\r
220\r
70da5bc2 221\r
6ad55b15 222EFI_STATUS\r
223EFIAPI\r
224ScsiDiskReset (\r
225 IN EFI_BLOCK_IO_PROTOCOL *This,\r
226 IN BOOLEAN ExtendedVerification\r
227 )\r
228/*++\r
229\r
230Routine Description:\r
231\r
f36d6e66 232 Reset SCSI Disk \r
6ad55b15 233\r
234Arguments:\r
235\r
f36d6e66 236 This - The pointer of EFI_BLOCK_IO_PROTOCOL\r
237 ExtendedVerification - The flag about if extend verificate\r
6ad55b15 238\r
239Returns:\r
240\r
f36d6e66 241 EFI_STATUS\r
6ad55b15 242\r
243--*/\r
244;\r
245\r
246EFI_STATUS\r
247EFIAPI\r
248ScsiDiskReadBlocks (\r
249 IN EFI_BLOCK_IO_PROTOCOL *This,\r
250 IN UINT32 MediaId,\r
251 IN EFI_LBA LBA,\r
252 IN UINTN BufferSize,\r
253 OUT VOID *Buffer\r
254 )\r
255/*++\r
256\r
257Routine Description:\r
258\r
f36d6e66 259 The function is to Read Block from SCSI Disk\r
6ad55b15 260\r
261Arguments:\r
262\r
f36d6e66 263 This - The pointer of EFI_BLOCK_IO_PROTOCOL\r
264 MediaId - The Id of Media detected\r
265 LBA - The logic block address\r
266 BufferSize - The size of Buffer\r
267 Buffer - The buffer to fill the read out data\r
6ad55b15 268\r
269Returns:\r
270\r
f36d6e66 271 EFI_INVALID_PARAMETER - Invalid parameter passed in.\r
272 EFI_SUCCESS - Successfully to read out block.\r
273 EFI_DEVICE_ERROR - Fail to detect media.\r
274 EFI_NO_MEDIA - Media is not present.\r
275 EFI_MEDIA_CHANGED - Media has changed.\r
276 EFI_BAD_BUFFER_SIZE - The buffer size is not multiple of BlockSize.\r
6ad55b15 277\r
278--*/\r
279;\r
280\r
281EFI_STATUS\r
282EFIAPI\r
283ScsiDiskWriteBlocks (\r
284 IN EFI_BLOCK_IO_PROTOCOL *This,\r
285 IN UINT32 MediaId,\r
286 IN EFI_LBA LBA,\r
287 IN UINTN BufferSize,\r
288 IN VOID *Buffer\r
289 )\r
290/*++\r
291\r
292Routine Description:\r
293\r
f36d6e66 294 The function is to Write Block to SCSI Disk\r
6ad55b15 295\r
296Arguments:\r
297\r
f36d6e66 298 This - The pointer of EFI_BLOCK_IO_PROTOCOL\r
299 MediaId - The Id of Media detected\r
300 LBA - The logic block address\r
301 BufferSize - The size of Buffer\r
302 Buffer - The buffer to fill the read out data\r
6ad55b15 303\r
304Returns:\r
305\r
f36d6e66 306 EFI_INVALID_PARAMETER - Invalid parameter passed in.\r
307 EFI_SUCCESS - Successfully to read out block.\r
308 EFI_DEVICE_ERROR - Fail to detect media.\r
309 EFI_NO_MEDIA - Media is not present.\r
310 EFI_MEDIA_CHANGED - Media has changed.\r
311 EFI_BAD_BUFFER_SIZE - The buffer size is not multiple of BlockSize.\r
6ad55b15 312\r
313--*/\r
314;\r
315\r
316EFI_STATUS\r
317EFIAPI\r
318ScsiDiskFlushBlocks (\r
319 IN EFI_BLOCK_IO_PROTOCOL *This\r
320 )\r
321/*++\r
322\r
323Routine Description:\r
324\r
f36d6e66 325 Flush Block to Disk\r
6ad55b15 326\r
327Arguments:\r
328\r
f36d6e66 329 This - The pointer of EFI_BLOCK_IO_PROTOCOL\r
6ad55b15 330\r
331Returns:\r
332\r
f36d6e66 333 EFI_SUCCESS \r
6ad55b15 334\r
335--*/\r
336;\r
337\r
338EFI_STATUS\r
339ScsiDiskDetectMedia (\r
340 SCSI_DISK_DEV *ScsiDiskDevice,\r
341 BOOLEAN MustReadCap,\r
342 BOOLEAN *MediaChange\r
343 )\r
344/*++\r
345\r
346Routine Description:\r
347\r
f36d6e66 348 Dectect Device and read out capacity ,if error occurs, parse the sense key.\r
6ad55b15 349\r
350Arguments:\r
351\r
f36d6e66 352 ScsiDiskDevice - The pointer of SCSI_DISK_DEV\r
353 MustReadCapacity - The flag about reading device capacity\r
354 MediaChange - The pointer of flag indicates if media has changed \r
6ad55b15 355\r
356Returns:\r
357\r
f36d6e66 358 EFI_DEVICE_ERROR - Indicates that error occurs\r
359 EFI_SUCCESS - Successfully to detect media\r
6ad55b15 360\r
361--*/\r
362;\r
f36d6e66 363\r
6ad55b15 364EFI_STATUS\r
365ScsiDiskTestUnitReady (\r
f36d6e66 366 SCSI_DISK_DEV *ScsiDiskDevice,\r
367 BOOLEAN *NeedRetry,\r
368 EFI_SCSI_SENSE_DATA **SenseDataArray,\r
369 UINTN *NumberOfSenseKeys\r
6ad55b15 370 )\r
371/*++\r
372\r
373Routine Description:\r
374\r
f36d6e66 375 When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;\r
376 When Test Unit Ready command encounters any error caused by host adapter or\r
377 target, return error without retrieving Sense Keys.\r
378 \r
6ad55b15 379Arguments:\r
380\r
f36d6e66 381 ScsiDiskDevice - The pointer of SCSI_DISK_DEV\r
382 NeedRetry - The pointer of flag indicates try again\r
383 SenseDataArray - The pointer of an array of sense data\r
384 NumberOfSenseKeys - The pointer of the number of sense data array\r
385 \r
6ad55b15 386Returns:\r
387\r
f36d6e66 388 EFI_DEVICE_ERROR - Indicates that error occurs\r
389 EFI_SUCCESS - Successfully to test unit\r
6ad55b15 390\r
391--*/\r
392;\r
393\r
394EFI_STATUS\r
395DetectMediaParsingSenseKeys (\r
396 SCSI_DISK_DEV *ScsiDiskDevice,\r
397 EFI_SCSI_SENSE_DATA *SenseData,\r
398 UINTN NumberOfSenseKeys,\r
399 UINTN *Action\r
400 )\r
401/*++\r
402\r
403Routine Description:\r
404\r
f36d6e66 405 Parsing Sense Keys which got from request sense command.\r
406 \r
6ad55b15 407Arguments:\r
408\r
f36d6e66 409 ScsiDiskDevice - The pointer of SCSI_DISK_DEV\r
410 SenseData - The pointer of EFI_SCSI_SENSE_DATA\r
411 NumberOfSenseKeys - The number of sense key \r
412 Action - The pointer of action which indicates what is need to do next\r
6ad55b15 413\r
414Returns:\r
415\r
f36d6e66 416 EFI_DEVICE_ERROR - Indicates that error occurs\r
417 EFI_SUCCESS - Successfully to complete the parsing\r
6ad55b15 418\r
419--*/\r
420;\r
421\r
422EFI_STATUS\r
423ScsiDiskReadCapacity (\r
f36d6e66 424 SCSI_DISK_DEV *ScsiDiskDevice,\r
425 BOOLEAN *NeedRetry,\r
426 EFI_SCSI_SENSE_DATA **SenseDataArray,\r
427 UINTN *NumberOfSenseKeys\r
6ad55b15 428 )\r
429/*++\r
430\r
431Routine Description:\r
432\r
f36d6e66 433 Send read capacity command to device and get the device parameter\r
6ad55b15 434\r
435Arguments:\r
436\r
f36d6e66 437 ScsiDiskDevice - The pointer of SCSI_DISK_DEV\r
438 NeedRetry - The pointer of flag indicates if need a retry\r
439 SenseDataArray - The pointer of an array of sense data\r
440 NumberOfSenseKeys - The number of sense key\r
6ad55b15 441\r
442Returns:\r
443\r
f36d6e66 444 EFI_DEVICE_ERROR - Indicates that error occurs\r
445 EFI_SUCCESS - Successfully to read capacity\r
6ad55b15 446\r
447--*/\r
448;\r
449\r
450EFI_STATUS\r
451CheckHostAdapterStatus (\r
452 UINT8 HostAdapterStatus\r
453 )\r
454/*++\r
455\r
456Routine Description:\r
457\r
f36d6e66 458 Check the HostAdapter status\r
459 \r
6ad55b15 460Arguments:\r
461\r
f36d6e66 462 HostAdapterStatus - Host Adapter status\r
6ad55b15 463\r
464Returns:\r
465\r
f36d6e66 466 EFI_SUCCESS \r
467 EFI_TIMEOUT \r
468 EFI_NOT_READY \r
469 EFI_DEVICE_ERROR \r
6ad55b15 470\r
471--*/\r
472;\r
473\r
474EFI_STATUS\r
475CheckTargetStatus (\r
476 UINT8 TargetStatus\r
477 )\r
478/*++\r
479\r
480Routine Description:\r
481\r
f36d6e66 482 Check the target status\r
483 \r
6ad55b15 484Arguments:\r
485\r
f36d6e66 486 TargetStatus - Target status\r
6ad55b15 487\r
488Returns:\r
489\r
f36d6e66 490 EFI_NOT_READY \r
491 EFI_DEVICE_ERROR \r
492 EFI_SUCCESS\r
6ad55b15 493\r
494--*/\r
495;\r
496\r
497EFI_STATUS\r
498ScsiDiskRequestSenseKeys (\r
499 SCSI_DISK_DEV *ScsiDiskDevice,\r
500 BOOLEAN *NeedRetry,\r
501 EFI_SCSI_SENSE_DATA **SenseDataArray,\r
502 UINTN *NumberOfSenseKeys,\r
503 BOOLEAN AskResetIfError\r
504 )\r
505/*++\r
506\r
507Routine Description:\r
508\r
f36d6e66 509 Retrieve all sense keys from the device.\r
510 When encountering error during the process,\r
511 if retrieve sense keys before error encounterred,\r
512 return the sense keys with return status set to EFI_SUCCESS,\r
513 and NeedRetry set to FALSE; otherwize, return the proper return\r
514 status.\r
6ad55b15 515\r
516Arguments:\r
517\r
f36d6e66 518 ScsiDiskDevice - The pointer of SCSI_DISK_DEV\r
519 NeedRetry - The pointer of flag indicates if need a retry\r
520 SenseDataArray - The pointer of an array of sense data\r
521 NumberOfSenseKeys - The number of sense key\r
522 AskResetIfError - The flag indicates if need reset when error occurs\r
523 \r
6ad55b15 524Returns:\r
525\r
f36d6e66 526 EFI_DEVICE_ERROR - Indicates that error occurs\r
527 EFI_SUCCESS - Successfully to request sense key\r
6ad55b15 528\r
529--*/\r
530;\r
531\r
532EFI_STATUS\r
533ScsiDiskInquiryDevice (\r
534 SCSI_DISK_DEV *ScsiDiskDevice,\r
535 BOOLEAN *NeedRetry\r
536 )\r
537/*++\r
538\r
539Routine Description:\r
540\r
f36d6e66 541 Send out Inquiry command to Device\r
6ad55b15 542\r
543Arguments:\r
544\r
f36d6e66 545 ScsiDiskDevice - The pointer of SCSI_DISK_DEV\r
546 NeedRetry - Indicates if needs try again when error happens\r
6ad55b15 547\r
548Returns:\r
549\r
f36d6e66 550 EFI_DEVICE_ERROR - Indicates that error occurs\r
551 EFI_SUCCESS - Successfully to detect media\r
6ad55b15 552\r
553--*/\r
554;\r
555\r
556VOID\r
557ParseInquiryData (\r
558 SCSI_DISK_DEV *ScsiDiskDevice\r
559 )\r
560/*++\r
561\r
562Routine Description:\r
563\r
f36d6e66 564 Parse Inquiry data\r
6ad55b15 565\r
566Arguments:\r
567\r
f36d6e66 568 ScsiDiskDevice - The pointer of SCSI_DISK_DEV\r
6ad55b15 569\r
570Returns:\r
571\r
f36d6e66 572 NONE\r
6ad55b15 573\r
574--*/\r
575;\r
576\r
577EFI_STATUS\r
578ScsiDiskReadSectors (\r
579 SCSI_DISK_DEV *ScsiDiskDevice,\r
580 VOID *Buffer,\r
581 EFI_LBA Lba,\r
582 UINTN NumberOfBlocks\r
583 )\r
584/*++\r
585\r
586Routine Description:\r
587\r
f36d6e66 588 Read sector from SCSI Disk\r
6ad55b15 589\r
590Arguments:\r
591\r
f36d6e66 592 ScsiDiskDevice - The poiniter of SCSI_DISK_DEV\r
593 Buffer - The buffer to fill in the read out data\r
594 Lba - Logic block address\r
595 NumberOfBlocks - The number of blocks to read\r
6ad55b15 596\r
597Returns:\r
598\r
f36d6e66 599 EFI_DEVICE_ERROR\r
600 EFI_SUCCESS\r
6ad55b15 601\r
602--*/\r
603;\r
604\r
605EFI_STATUS\r
606ScsiDiskWriteSectors (\r
607 SCSI_DISK_DEV *ScsiDiskDevice,\r
608 VOID *Buffer,\r
609 EFI_LBA Lba,\r
610 UINTN NumberOfBlocks\r
611 )\r
612/*++\r
613\r
614Routine Description:\r
615\r
f36d6e66 616 Write SCSI Disk sectors\r
6ad55b15 617\r
618Arguments:\r
619\r
f36d6e66 620 ScsiDiskDevice - The pointer of SCSI_DISK_DEV\r
621 Buffer - The data buffer to write sector\r
622 Lba - Logic block address\r
623 NumberOfBlocks - The number of blocks to write\r
6ad55b15 624\r
625Returns:\r
626\r
f36d6e66 627 EFI_DEVICE_ERROR \r
628 EFI_SUCCESS\r
6ad55b15 629\r
630--*/\r
631;\r
632\r
633EFI_STATUS\r
634ScsiDiskRead10 (\r
635 SCSI_DISK_DEV *ScsiDiskDevice,\r
636 BOOLEAN *NeedRetry,\r
637 EFI_SCSI_SENSE_DATA **SenseDataArray,\r
638 UINTN *NumberOfSenseKeys,\r
639 UINT64 Timeout,\r
640 UINT8 *DataBuffer,\r
641 UINT32 *DataLength,\r
642 UINT32 StartLba,\r
643 UINT32 SectorSize\r
644 )\r
645/*++\r
646\r
647Routine Description:\r
648\r
f36d6e66 649 Sumbmit Read command \r
6ad55b15 650\r
651Arguments:\r
652\r
f36d6e66 653 ScsiDiskDevice - The pointer of ScsiDiskDevice\r
654 NeedRetry - The pointer of flag indicates if needs retry if error happens\r
655 SenseDataArray - The pointer of an array of sense data\r
656 NumberOfSenseKeys - The number of sense key\r
657 Timeout - The time to complete the command\r
658 DataBuffer - The buffer to fill with the read out data\r
659 DataLength - The length of buffer\r
660 StartLba - The start logic block address\r
661 SectorSize - The size of sector\r
6ad55b15 662\r
663Returns:\r
664\r
f36d6e66 665 EFI_STATUS\r
6ad55b15 666\r
667--*/\r
668;\r
669\r
670EFI_STATUS\r
671ScsiDiskWrite10 (\r
672 SCSI_DISK_DEV *ScsiDiskDevice,\r
673 BOOLEAN *NeedRetry,\r
674 EFI_SCSI_SENSE_DATA **SenseDataArray,\r
675 UINTN *NumberOfSenseKeys,\r
676 UINT64 Timeout,\r
677 UINT8 *DataBuffer,\r
678 UINT32 *DataLength,\r
679 UINT32 StartLba,\r
680 UINT32 SectorSize\r
681 )\r
682/*++\r
683\r
684Routine Description:\r
685\r
f36d6e66 686 Submit Write Command\r
6ad55b15 687\r
688Arguments:\r
689\r
f36d6e66 690 ScsiDiskDevice - The pointer of ScsiDiskDevice\r
691 NeedRetry - The pointer of flag indicates if needs retry if error happens\r
692 SenseDataArray - The pointer of an array of sense data\r
693 NumberOfSenseKeys - The number of sense key\r
694 Timeout - The time to complete the command\r
695 DataBuffer - The buffer to fill with the read out data\r
696 DataLength - The length of buffer\r
697 StartLba - The start logic block address\r
698 SectorSize - The size of sector\r
6ad55b15 699\r
700Returns:\r
701\r
f36d6e66 702 EFI_STATUS\r
6ad55b15 703\r
704--*/\r
705;\r
706\r
707VOID\r
708GetMediaInfo (\r
709 SCSI_DISK_DEV *ScsiDiskDevice,\r
710 EFI_SCSI_DISK_CAPACITY_DATA *Capacity\r
711 )\r
712/*++\r
713\r
714Routine Description:\r
715\r
f36d6e66 716 Get information from media read capacity command\r
6ad55b15 717\r
718Arguments:\r
719\r
f36d6e66 720 ScsiDiskDevice - The pointer of SCSI_DISK_DEV\r
721 Capacity - The pointer of EFI_SCSI_DISK_CAPACITY_DATA\r
6ad55b15 722\r
723Returns:\r
724\r
f36d6e66 725 NONE\r
6ad55b15 726\r
727--*/\r
728;\r
729\r
730BOOLEAN\r
731ScsiDiskIsNoMedia (\r
732 IN EFI_SCSI_SENSE_DATA *SenseData,\r
733 IN UINTN SenseCounts\r
734 )\r
735/*++\r
736\r
737Routine Description:\r
738\r
f36d6e66 739 Check sense key to find if media presents\r
6ad55b15 740\r
741Arguments:\r
742\r
f36d6e66 743 SenseData - The pointer of EFI_SCSI_SENSE_DATA\r
744 SenseCounts - The number of sense key\r
6ad55b15 745\r
746Returns:\r
747\r
f36d6e66 748 BOOLEAN\r
6ad55b15 749\r
750--*/\r
751;\r
752\r
753BOOLEAN\r
754ScsiDiskIsMediaError (\r
755 IN EFI_SCSI_SENSE_DATA *SenseData,\r
756 IN UINTN SenseCounts\r
757 )\r
758/*++\r
759\r
760Routine Description:\r
761\r
f36d6e66 762 Parse sense key\r
6ad55b15 763\r
764Arguments:\r
765\r
f36d6e66 766 SenseData - The pointer of EFI_SCSI_SENSE_DATA\r
767 SenseCounts - The number of sense key\r
6ad55b15 768\r
769Returns:\r
770\r
f36d6e66 771 BOOLEAN\r
6ad55b15 772\r
773--*/\r
774;\r
775\r
776BOOLEAN\r
777ScsiDiskIsHardwareError (\r
778 IN EFI_SCSI_SENSE_DATA *SenseData,\r
779 IN UINTN SenseCounts\r
780 )\r
781/*++\r
782\r
783Routine Description:\r
784\r
f36d6e66 785 Check sense key to find if hardware error happens\r
6ad55b15 786\r
787Arguments:\r
788\r
f36d6e66 789 SenseData - The pointer of EFI_SCSI_SENSE_DATA\r
790 SenseCounts - The number of sense key\r
6ad55b15 791\r
792Returns:\r
793\r
f36d6e66 794 BOOLEAN\r
6ad55b15 795\r
796--*/\r
797;\r
798\r
799BOOLEAN\r
800ScsiDiskIsMediaChange (\r
801 IN EFI_SCSI_SENSE_DATA *SenseData,\r
802 IN UINTN SenseCounts\r
803 )\r
804/*++\r
805\r
806Routine Description:\r
807\r
f36d6e66 808Routine Description:\r
809\r
810 Check sense key to find if media has changed\r
6ad55b15 811\r
812Arguments:\r
813\r
f36d6e66 814 SenseData - The pointer of EFI_SCSI_SENSE_DATA\r
815 SenseCounts - The number of sense key\r
6ad55b15 816\r
817Returns:\r
818\r
f36d6e66 819 BOOLEAN\r
6ad55b15 820\r
821--*/\r
822;\r
823\r
824BOOLEAN\r
825ScsiDiskIsResetBefore (\r
826 IN EFI_SCSI_SENSE_DATA *SenseData,\r
827 IN UINTN SenseCounts\r
828 )\r
829/*++\r
830\r
831Routine Description:\r
832\r
f36d6e66 833 Check sense key to find if reset happens\r
6ad55b15 834\r
835Arguments:\r
836\r
f36d6e66 837 SenseData - The pointer of EFI_SCSI_SENSE_DATA\r
838 SenseCounts - The number of sense key\r
6ad55b15 839\r
840Returns:\r
841\r
f36d6e66 842 BOOLEAN\r
6ad55b15 843\r
844--*/\r
845;\r
846\r
847BOOLEAN\r
848ScsiDiskIsDriveReady (\r
849 IN EFI_SCSI_SENSE_DATA *SenseData,\r
850 IN UINTN SenseCounts,\r
851 OUT BOOLEAN *NeedRetry\r
852 )\r
853/*++\r
854\r
855Routine Description:\r
856\r
f36d6e66 857 Check sense key to find if the drive is ready\r
6ad55b15 858\r
859Arguments:\r
860\r
f36d6e66 861 SenseData - The pointer of EFI_SCSI_SENSE_DATA\r
862 SenseCounts - The number of sense key\r
863 RetryLater - The flag means if need a retry \r
6ad55b15 864\r
865Returns:\r
866\r
f36d6e66 867 BOOLEAN\r
6ad55b15 868\r
869--*/\r
870;\r
871\r
872BOOLEAN\r
873ScsiDiskHaveSenseKey (\r
874 IN EFI_SCSI_SENSE_DATA *SenseData,\r
875 IN UINTN SenseCounts\r
876 )\r
877/*++\r
878\r
879Routine Description:\r
880\r
f36d6e66 881 Check sense key to find if it has sense key\r
6ad55b15 882\r
883Arguments:\r
884\r
f36d6e66 885 SenseData - The pointer of EFI_SCSI_SENSE_DATA\r
886 SenseCounts - The number of sense key\r
6ad55b15 887\r
888Returns:\r
889\r
f36d6e66 890 BOOLEAN\r
6ad55b15 891\r
892--*/\r
893;\r
894\r
895VOID\r
896ReleaseScsiDiskDeviceResources (\r
897 IN SCSI_DISK_DEV *ScsiDiskDevice\r
898 )\r
899/*++\r
900\r
901Routine Description:\r
902\r
f36d6e66 903 Release resource about disk device\r
6ad55b15 904\r
905Arguments:\r
906\r
f36d6e66 907 ScsiDiskDevice - The pointer of SCSI_DISK_DEV\r
6ad55b15 908\r
909Returns:\r
910\r
f36d6e66 911 NONE\r
6ad55b15 912\r
913--*/\r
914;\r
915\r
916#endif\r