]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
Code Scrub:
[mirror_edk2.git] / MdeModulePkg / Bus / Scsi / ScsiDiskDxe / ScsiDisk.h
1 /** @file
2 Header file for SCSI Disk Driver.
3
4 Copyright (c) 2004 - 2008, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _SCSI_DISK_H_
16 #define _SCSI_DISK_H_
17
18
19 #include <Uefi.h>
20
21
22 #include <Protocol/ScsiIo.h>
23 #include <Protocol/ComponentName.h>
24 #include <Protocol/BlockIo.h>
25 #include <Protocol/DriverBinding.h>
26 #include <Protocol/ScsiPassThruExt.h>
27
28 #include <Library/DebugLib.h>
29 #include <Library/UefiDriverEntryPoint.h>
30 #include <Library/UefiLib.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/ScsiLib.h>
33 #include <Library/UefiBootServicesTableLib.h>
34
35 #include <IndustryStandard/Scsi.h>
36
37 #define IS_DEVICE_FIXED(a) (a)->FixedDevice ? 1 : 0
38
39 #define SCSI_DISK_DEV_SIGNATURE EFI_SIGNATURE_32 ('s', 'c', 'd', 'k')
40
41 typedef struct {
42 UINT32 Signature;
43
44 EFI_HANDLE Handle;
45
46 EFI_BLOCK_IO_PROTOCOL BlkIo;
47 EFI_BLOCK_IO_MEDIA BlkIoMedia;
48 EFI_SCSI_IO_PROTOCOL *ScsiIo;
49 UINT8 DeviceType;
50 BOOLEAN FixedDevice;
51 UINT16 Reserved;
52
53 EFI_SCSI_SENSE_DATA *SenseData;
54 UINTN SenseDataNumber;
55 EFI_SCSI_INQUIRY_DATA InquiryData;
56
57 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
58
59 } SCSI_DISK_DEV;
60
61 #define SCSI_DISK_DEV_FROM_THIS(a) CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)
62
63 //
64 // Global Variables
65 //
66 extern EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding;
67 extern EFI_COMPONENT_NAME_PROTOCOL gScsiDiskComponentName;
68 extern EFI_COMPONENT_NAME2_PROTOCOL gScsiDiskComponentName2;
69 //
70 // action code used in detect media process
71 //
72 #define ACTION_NO_ACTION 0x00
73 #define ACTION_READ_CAPACITY 0x01
74 #define ACTION_RETRY_COMMAND_LATER 0x02
75
76 /**
77 Test to see if this driver supports ControllerHandle.
78
79 This service is called by the EFI boot service ConnectController(). In order
80 to make drivers as small as possible, there are a few calling restrictions for
81 this service. ConnectController() must follow these calling restrictions.
82 If any other agent wishes to call Supported() it must also follow these
83 calling restrictions.
84
85 @param This Protocol instance pointer.
86 @param ControllerHandle Handle of device to test
87 @param RemainingDevicePath Optional parameter use to pick a specific child
88 device to start.
89
90 @retval EFI_SUCCESS This driver supports this device
91 @retval EFI_ALREADY_STARTED This driver is already running on this device
92 @retval other This driver does not support this device
93
94 **/
95 EFI_STATUS
96 EFIAPI
97 ScsiDiskDriverBindingSupported (
98 IN EFI_DRIVER_BINDING_PROTOCOL *This,
99 IN EFI_HANDLE Controller,
100 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
101 );
102
103 /**
104 Start this driver on ControllerHandle.
105
106 This service is called by the EFI boot service ConnectController(). In order
107 to make drivers as small as possible, there are a few calling restrictions for
108 this service. ConnectController() must follow these calling restrictions. If
109 any other agent wishes to call Start() it must also follow these calling
110 restrictions.
111
112 @param This Protocol instance pointer.
113 @param ControllerHandle Handle of device to bind driver to
114 @param RemainingDevicePath Optional parameter use to pick a specific child
115 device to start.
116
117 @retval EFI_SUCCESS This driver is added to ControllerHandle
118 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
119 @retval other This driver does not support this device
120
121 **/
122 EFI_STATUS
123 EFIAPI
124 ScsiDiskDriverBindingStart (
125 IN EFI_DRIVER_BINDING_PROTOCOL *This,
126 IN EFI_HANDLE Controller,
127 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
128 );
129
130 /**
131 Stop this driver on ControllerHandle.
132
133 This service is called by the EFI boot service DisconnectController().
134 In order to make drivers as small as possible, there are a few calling
135 restrictions for this service. DisconnectController() must follow these
136 calling restrictions. If any other agent wishes to call Stop() it must
137 also follow these calling restrictions.
138
139 @param This Protocol instance pointer.
140 @param ControllerHandle Handle of device to stop driver on
141 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
142 children is zero stop the entire bus driver.
143 @param ChildHandleBuffer List of Child Handles to Stop.
144
145 @retval EFI_SUCCESS This driver is removed ControllerHandle
146 @retval other This driver was not removed from this device
147
148 **/
149 EFI_STATUS
150 EFIAPI
151 ScsiDiskDriverBindingStop (
152 IN EFI_DRIVER_BINDING_PROTOCOL *This,
153 IN EFI_HANDLE Controller,
154 IN UINTN NumberOfChildren,
155 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
156 );
157
158 //
159 // EFI Component Name Functions
160 //
161 /**
162 Retrieves a Unicode string that is the user readable name of the driver.
163
164 This function retrieves the user readable name of a driver in the form of a
165 Unicode string. If the driver specified by This has a user readable name in
166 the language specified by Language, then a pointer to the driver name is
167 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
168 by This does not support the language specified by Language,
169 then EFI_UNSUPPORTED is returned.
170
171 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
172 EFI_COMPONENT_NAME_PROTOCOL instance.
173
174 @param Language A pointer to a Null-terminated ASCII string
175 array indicating the language. This is the
176 language of the driver name that the caller is
177 requesting, and it must match one of the
178 languages specified in SupportedLanguages. The
179 number of languages supported by a driver is up
180 to the driver writer. Language is specified
181 in RFC 3066 or ISO 639-2 language code format.
182
183 @param DriverName A pointer to the Unicode string to return.
184 This Unicode string is the name of the
185 driver specified by This in the language
186 specified by Language.
187
188 @retval EFI_SUCCESS The Unicode string for the Driver specified by
189 This and the language specified by Language was
190 returned in DriverName.
191
192 @retval EFI_INVALID_PARAMETER Language is NULL.
193
194 @retval EFI_INVALID_PARAMETER DriverName is NULL.
195
196 @retval EFI_UNSUPPORTED The driver specified by This does not support
197 the language specified by Language.
198
199 **/
200 EFI_STATUS
201 EFIAPI
202 ScsiDiskComponentNameGetDriverName (
203 IN EFI_COMPONENT_NAME_PROTOCOL *This,
204 IN CHAR8 *Language,
205 OUT CHAR16 **DriverName
206 );
207
208
209 /**
210 Retrieves a Unicode string that is the user readable name of the controller
211 that is being managed by a driver.
212
213 This function retrieves the user readable name of the controller specified by
214 ControllerHandle and ChildHandle in the form of a Unicode string. If the
215 driver specified by This has a user readable name in the language specified by
216 Language, then a pointer to the controller name is returned in ControllerName,
217 and EFI_SUCCESS is returned. If the driver specified by This is not currently
218 managing the controller specified by ControllerHandle and ChildHandle,
219 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
220 support the language specified by Language, then EFI_UNSUPPORTED is returned.
221
222 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
223 EFI_COMPONENT_NAME_PROTOCOL instance.
224
225 @param ControllerHandle The handle of a controller that the driver
226 specified by This is managing. This handle
227 specifies the controller whose name is to be
228 returned.
229
230 @param ChildHandle The handle of the child controller to retrieve
231 the name of. This is an optional parameter that
232 may be NULL. It will be NULL for device
233 drivers. It will also be NULL for a bus drivers
234 that wish to retrieve the name of the bus
235 controller. It will not be NULL for a bus
236 driver that wishes to retrieve the name of a
237 child controller.
238
239 @param Language A pointer to a Null-terminated ASCII string
240 array indicating the language. This is the
241 language of the driver name that the caller is
242 requesting, and it must match one of the
243 languages specified in SupportedLanguages. The
244 number of languages supported by a driver is up
245 to the driver writer. Language is specified in
246 RFC 3066 or ISO 639-2 language code format.
247
248 @param ControllerName A pointer to the Unicode string to return.
249 This Unicode string is the name of the
250 controller specified by ControllerHandle and
251 ChildHandle in the language specified by
252 Language from the point of view of the driver
253 specified by This.
254
255 @retval EFI_SUCCESS The Unicode string for the user readable name in
256 the language specified by Language for the
257 driver specified by This was returned in
258 DriverName.
259
260 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
261
262 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
263 EFI_HANDLE.
264
265 @retval EFI_INVALID_PARAMETER Language is NULL.
266
267 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
268
269 @retval EFI_UNSUPPORTED The driver specified by This is not currently
270 managing the controller specified by
271 ControllerHandle and ChildHandle.
272
273 @retval EFI_UNSUPPORTED The driver specified by This does not support
274 the language specified by Language.
275
276 **/
277 EFI_STATUS
278 EFIAPI
279 ScsiDiskComponentNameGetControllerName (
280 IN EFI_COMPONENT_NAME_PROTOCOL *This,
281 IN EFI_HANDLE ControllerHandle,
282 IN EFI_HANDLE ChildHandle OPTIONAL,
283 IN CHAR8 *Language,
284 OUT CHAR16 **ControllerName
285 );
286
287 /**
288 Reset SCSI Disk.
289
290
291 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
292 @param ExtendedVerification The flag about if extend verificate
293
294 @retval EFI_SUCCESS The device was reset.
295 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
296 not be reset.
297 @return EFI_STATUS is retured from EFI_SCSI_IO_PROTOCOL.ResetDevice().
298
299 **/
300 EFI_STATUS
301 EFIAPI
302 ScsiDiskReset (
303 IN EFI_BLOCK_IO_PROTOCOL *This,
304 IN BOOLEAN ExtendedVerification
305 );
306
307
308 /**
309 The function is to Read Block from SCSI Disk.
310
311 @param This The pointer of EFI_BLOCK_IO_PROTOCOL.
312 @param MediaId The Id of Media detected
313 @param Lba The logic block address
314 @param BufferSize The size of Buffer
315 @param Buffer The buffer to fill the read out data
316
317 @retval EFI_SUCCESS Successfully to read out block.
318 @retval EFI_DEVICE_ERROR Fail to detect media.
319 @retval EFI_NO_MEDIA Media is not present.
320 @retval EFI_MEDIA_CHANGED Media has changed.
321 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
322 @retval EFI_INVALID_PARAMETER Invalid parameter passed in.
323
324 **/
325 EFI_STATUS
326 EFIAPI
327 ScsiDiskReadBlocks (
328 IN EFI_BLOCK_IO_PROTOCOL *This,
329 IN UINT32 MediaId,
330 IN EFI_LBA Lba,
331 IN UINTN BufferSize,
332 OUT VOID *Buffer
333 );
334
335
336 /**
337 The function is to Write Block to SCSI Disk.
338
339 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
340 @param MediaId The Id of Media detected
341 @param Lba The logic block address
342 @param BufferSize The size of Buffer
343 @param Buffer The buffer to fill the read out data
344
345 @retval EFI_SUCCESS Successfully to read out block.
346 @retval EFI_WRITE_PROTECTED The device can not be written to.
347 @retval EFI_DEVICE_ERROR Fail to detect media.
348 @retval EFI_NO_MEDIA Media is not present.
349 @retval EFI_MEDIA_CHNAGED Media has changed.
350 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
351 @retval EFI_INVALID_PARAMETER Invalid parameter passed in.
352
353 **/
354 EFI_STATUS
355 EFIAPI
356 ScsiDiskWriteBlocks (
357 IN EFI_BLOCK_IO_PROTOCOL *This,
358 IN UINT32 MediaId,
359 IN EFI_LBA Lba,
360 IN UINTN BufferSize,
361 IN VOID *Buffer
362 );
363
364
365 /**
366 Flush Block to Disk.
367
368 EFI_SUCCESS is returned directly.
369
370 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
371
372 @retval EFI_SUCCESS All outstanding data was written to the device
373
374 **/
375 EFI_STATUS
376 EFIAPI
377 ScsiDiskFlushBlocks (
378 IN EFI_BLOCK_IO_PROTOCOL *This
379 );
380
381 /**
382 Dectect Device and read out capacity ,if error occurs, parse the sense key.
383
384 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
385 @param MustReadCapacity The flag about reading device capacity
386 @param MediaChange The pointer of flag indicates if media has changed
387
388 @retval EFI_DEVICE_ERROR Indicates that error occurs
389 @retval EFI_SUCCESS Successfully to detect media
390
391 **/
392 EFI_STATUS
393 ScsiDiskDetectMedia (
394 IN SCSI_DISK_DEV *ScsiDiskDevice,
395 IN BOOLEAN MustReadCapacity,
396 OUT BOOLEAN *MediaChange
397 );
398
399 /**
400 To test deivice.
401
402 When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;
403 When Test Unit Ready command encounters any error caused by host adapter or
404 target, return error without retrieving Sense Keys.
405
406 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
407 @param NeedRetry The pointer of flag indicates try again
408 @param SenseDataArray The pointer of an array of sense data
409 @param NumberOfSenseKeys The pointer of the number of sense data array
410
411 @retval EFI_DEVICE_ERROR Indicates that error occurs
412 @retval EFI_SUCCESS Successfully to test unit
413
414 **/
415 EFI_STATUS
416 ScsiDiskTestUnitReady (
417 IN SCSI_DISK_DEV *ScsiDiskDevice,
418 OUT BOOLEAN *NeedRetry,
419 OUT EFI_SCSI_SENSE_DATA **SenseDataArray,
420 OUT UINTN *NumberOfSenseKeys
421 );
422
423
424 /**
425 Parsing Sense Keys which got from request sense command.
426
427 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
428 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
429 @param NumberOfSenseKeys The number of sense key
430 @param Action The pointer of action which indicates what is need to do next
431
432 @retval EFI_DEVICE_ERROR Indicates that error occurs
433 @retval EFI_SUCCESS Successfully to complete the parsing
434
435 **/
436 EFI_STATUS
437 DetectMediaParsingSenseKeys (
438 OUT SCSI_DISK_DEV *ScsiDiskDevice,
439 IN EFI_SCSI_SENSE_DATA *SenseData,
440 IN UINTN NumberOfSenseKeys,
441 OUT UINTN *Action
442 );
443
444
445 /**
446 Send read capacity command to device and get the device parameter.
447
448 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
449 @param NeedRetry The pointer of flag indicates if need a retry
450 @param SenseDataArray The pointer of an array of sense data
451 @param NumberOfSenseKeys The number of sense key
452
453 @retval EFI_DEVICE_ERROR Indicates that error occurs
454 @retval EFI_SUCCESS Successfully to read capacity
455
456 **/
457 EFI_STATUS
458 ScsiDiskReadCapacity (
459 IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
460 OUT BOOLEAN *NeedRetry,
461 OUT EFI_SCSI_SENSE_DATA **SenseDataArray,
462 OUT UINTN *NumberOfSenseKeys
463 );
464
465 /**
466 Check the HostAdapter status and re-interpret it in EFI_STATUS.
467
468 @param HostAdapterStatus Host Adapter status
469
470 @retval EFI_SUCCESS Host adapter is OK.
471 @retval EFI_TIMEOUT Timeout.
472 @retval EFI_NOT_READY Adapter NOT ready.
473 @retval EFI_DEVICE_ERROR Adapter device error.
474
475 **/
476 EFI_STATUS
477 CheckHostAdapterStatus (
478 IN UINT8 HostAdapterStatus
479 );
480
481
482 /**
483 Check the target status and re-interpret it in EFI_STATUS.
484
485 @param TargetStatus Target status
486
487 @retval EFI_NOT_READY Device is NOT ready.
488 @retval EFI_DEVICE_ERROR
489 @retval EFI_SUCCESS
490
491 **/
492 EFI_STATUS
493 CheckTargetStatus (
494 IN UINT8 TargetStatus
495 );
496
497 /**
498 Retrieve all sense keys from the device.
499
500 When encountering error during the process, if retrieve sense keys before
501 error encounterred, it returns the sense keys with return status set to EFI_SUCCESS,
502 and NeedRetry set to FALSE; otherwize, return the proper return status.
503
504 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
505 @param NeedRetry The pointer of flag indicates if need a retry
506 @param SenseDataArray The pointer of an array of sense data
507 @param NumberOfSenseKeys The number of sense key
508 @param AskResetIfError The flag indicates if need reset when error occurs
509
510 @retval EFI_DEVICE_ERROR Indicates that error occurs
511 @retval EFI_SUCCESS Successfully to request sense key
512
513 **/
514 EFI_STATUS
515 ScsiDiskRequestSenseKeys (
516 IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
517 OUT BOOLEAN *NeedRetry,
518 OUT EFI_SCSI_SENSE_DATA **SenseDataArray,
519 OUT UINTN *NumberOfSenseKeys,
520 IN BOOLEAN AskResetIfError
521 );
522
523 /**
524 Send out Inquiry command to Device.
525
526 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
527 @param NeedRetry Indicates if needs try again when error happens
528
529 @retval EFI_DEVICE_ERROR Indicates that error occurs
530 @retval EFI_SUCCESS Successfully to detect media
531
532 **/
533 EFI_STATUS
534 ScsiDiskInquiryDevice (
535 IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
536 OUT BOOLEAN *NeedRetry
537 );
538
539 /**
540 Parse Inquiry data.
541
542 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
543
544 **/
545 VOID
546 ParseInquiryData (
547 IN OUT SCSI_DISK_DEV *ScsiDiskDevice
548 );
549
550 /**
551 Read sector from SCSI Disk.
552
553 @param ScsiDiskDevice The poiniter of SCSI_DISK_DEV
554 @param Buffer The buffer to fill in the read out data
555 @param Lba Logic block address
556 @param NumberOfBlocks The number of blocks to read
557
558 @retval EFI_DEVICE_ERROR Indicates a device error.
559 @retval EFI_SUCCESS Operation is successful.
560
561 **/
562 EFI_STATUS
563 ScsiDiskReadSectors (
564 IN SCSI_DISK_DEV *ScsiDiskDevice,
565 OUT VOID *Buffer,
566 IN EFI_LBA Lba,
567 IN UINTN NumberOfBlocks
568 );
569
570 /**
571 Write sector to SCSI Disk.
572
573 @param ScsiDiskDevice The poiniter of SCSI_DISK_DEV
574 @param Buffer The buffer of data to be written into SCSI Disk
575 @param Lba Logic block address
576 @param NumberOfBlocks The number of blocks to read
577
578 @retval EFI_DEVICE_ERROR Indicates a device error.
579 @retval EFI_SUCCESS Operation is successful.
580
581 **/
582 EFI_STATUS
583 ScsiDiskWriteSectors (
584 IN SCSI_DISK_DEV *ScsiDiskDevice,
585 IN VOID *Buffer,
586 IN EFI_LBA Lba,
587 IN UINTN NumberOfBlocks
588 );
589
590 /**
591 Sumbmit Read command.
592
593 @param ScsiDiskDevice The pointer of ScsiDiskDevice
594 @param NeedRetry The pointer of flag indicates if needs retry if error happens
595 @param SenseDataArray NOT used yet in this function
596 @param NumberOfSenseKeys The number of sense key
597 @param Timeout The time to complete the command
598 @param DataBuffer The buffer to fill with the read out data
599 @param DataLength The length of buffer
600 @param StartLba The start logic block address
601 @param SectorSize The size of sector
602
603 @return EFI_STATUS is returned by calling ScsiRead10Command().
604 **/
605 EFI_STATUS
606 ScsiDiskRead10 (
607 IN SCSI_DISK_DEV *ScsiDiskDevice,
608 OUT BOOLEAN *NeedRetry,
609 OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL
610 OUT UINTN *NumberOfSenseKeys,
611 IN UINT64 Timeout,
612 OUT UINT8 *DataBuffer,
613 IN OUT UINT32 *DataLength,
614 IN UINT32 StartLba,
615 IN UINT32 SectorSize
616 );
617
618 /**
619 Submit Write Command.
620
621 @param ScsiDiskDevice The pointer of ScsiDiskDevice
622 @param NeedRetry The pointer of flag indicates if needs retry if error happens
623 @param SenseDataArray NOT used yet in this function
624 @param NumberOfSenseKeys The number of sense key
625 @param Timeout The time to complete the command
626 @param DataBuffer The buffer to fill with the read out data
627 @param DataLength The length of buffer
628 @param StartLba The start logic block address
629 @param SectorSize The size of sector
630
631 @return EFI_STATUS is returned by calling ScsiWrite10Command().
632
633 **/
634 EFI_STATUS
635 ScsiDiskWrite10 (
636 IN SCSI_DISK_DEV *ScsiDiskDevice,
637 OUT BOOLEAN *NeedRetry,
638 OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL
639 OUT UINTN *NumberOfSenseKeys,
640 IN UINT64 Timeout,
641 IN UINT8 *DataBuffer,
642 IN OUT UINT32 *DataLength,
643 IN UINT32 StartLba,
644 IN UINT32 SectorSize
645 );
646
647 /**
648 Get information from media read capacity command.
649
650 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
651 @param Capacity The pointer of EFI_SCSI_DISK_CAPACITY_DATA
652
653 **/
654 VOID
655 GetMediaInfo (
656 IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
657 IN EFI_SCSI_DISK_CAPACITY_DATA *Capacity
658 );
659
660 /**
661 Check sense key to find if media presents.
662
663 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
664 @param SenseCounts The number of sense key
665
666 @retval TRUE NOT any media
667 @retval FALSE Media presents
668 **/
669 BOOLEAN
670 ScsiDiskIsNoMedia (
671 IN EFI_SCSI_SENSE_DATA *SenseData,
672 IN UINTN SenseCounts
673 );
674
675 /**
676 Parse sense key.
677
678 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
679 @param SenseCounts The number of sense key
680
681 @retval TRUE Error
682 @retval FALSE NOT error
683
684 **/
685 BOOLEAN
686 ScsiDiskIsMediaError (
687 IN EFI_SCSI_SENSE_DATA *SenseData,
688 IN UINTN SenseCounts
689 );
690
691 /**
692 Check sense key to find if hardware error happens.
693
694 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
695 @param SenseCounts The number of sense key
696
697 @retval TRUE Hardware error exits.
698 @retval FALSE NO error.
699
700 **/
701 BOOLEAN
702 ScsiDiskIsHardwareError (
703 IN EFI_SCSI_SENSE_DATA *SenseData,
704 IN UINTN SenseCounts
705 );
706
707 /**
708 Check sense key to find if media has changed.
709
710 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
711 @param SenseCounts The number of sense key
712
713 @retval TRUE Media is changed.
714 @retval FALSE Medit is NOT changed.
715 **/
716 BOOLEAN
717 ScsiDiskIsMediaChange (
718 IN EFI_SCSI_SENSE_DATA *SenseData,
719 IN UINTN SenseCounts
720 );
721
722 /**
723 Check sense key to find if reset happens.
724
725 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
726 @param SenseCounts The number of sense key
727
728 @retval TRUE It is reset before.
729 @retval FALSE It is NOT reset before.
730
731 **/
732 BOOLEAN
733 ScsiDiskIsResetBefore (
734 IN EFI_SCSI_SENSE_DATA *SenseData,
735 IN UINTN SenseCounts
736 );
737
738 /**
739 Check sense key to find if the drive is ready.
740
741 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
742 @param SenseCounts The number of sense key
743 @param RetryLater The flag means if need a retry
744
745 @retval TRUE Drive is ready.
746 @retval FALSE Drive is NOT ready.
747
748 **/
749 BOOLEAN
750 ScsiDiskIsDriveReady (
751 IN EFI_SCSI_SENSE_DATA *SenseData,
752 IN UINTN SenseCounts,
753 OUT BOOLEAN *RetryLater
754 );
755
756 /**
757 Check sense key to find if it has sense key.
758
759 @param SenseData - The pointer of EFI_SCSI_SENSE_DATA
760 @param SenseCounts - The number of sense key
761
762 @retval TRUE It has sense key.
763 @retval FALSE It has NOT any sense key.
764
765 **/
766 BOOLEAN
767 ScsiDiskHaveSenseKey (
768 IN EFI_SCSI_SENSE_DATA *SenseData,
769 IN UINTN SenseCounts
770 );
771
772 /**
773 Release resource about disk device.
774
775 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
776
777 **/
778 VOID
779 ReleaseScsiDiskDeviceResources (
780 IN SCSI_DISK_DEV *ScsiDiskDevice
781 );
782
783 #endif