2 Header file for SCSI Disk Driver.
4 Copyright (c) 2004 - 2010, 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
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.
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 #include <Protocol/ScsiPassThru.h>
28 #include <Protocol/DiskInfo.h>
31 #include <Library/DebugLib.h>
32 #include <Library/UefiDriverEntryPoint.h>
33 #include <Library/UefiLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/MemoryAllocationLib.h>
36 #include <Library/UefiScsiLib.h>
37 #include <Library/UefiBootServicesTableLib.h>
38 #include <Library/DevicePathLib.h>
40 #include <IndustryStandard/Scsi.h>
41 #include <IndustryStandard/Atapi.h>
43 #define IS_DEVICE_FIXED(a) (a)->FixedDevice ? 1 : 0
45 #define SCSI_DISK_DEV_SIGNATURE SIGNATURE_32 ('s', 'c', 'd', 'k')
52 EFI_BLOCK_IO_PROTOCOL BlkIo
;
53 EFI_BLOCK_IO_MEDIA BlkIoMedia
;
54 EFI_SCSI_IO_PROTOCOL
*ScsiIo
;
59 EFI_SCSI_SENSE_DATA
*SenseData
;
60 UINTN SenseDataNumber
;
61 EFI_SCSI_INQUIRY_DATA InquiryData
;
63 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
65 EFI_DISK_INFO_PROTOCOL DiskInfo
;
68 // The following fields are only valid for ATAPI/SATA device
72 ATAPI_IDENTIFY_DATA IdentifyData
;
75 #define SCSI_DISK_DEV_FROM_THIS(a) CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)
77 #define SCSI_DISK_DEV_FROM_DISKINFO(a) CR (a, SCSI_DISK_DEV, DiskInfo, SCSI_DISK_DEV_SIGNATURE)
82 extern EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding
;
83 extern EFI_COMPONENT_NAME_PROTOCOL gScsiDiskComponentName
;
84 extern EFI_COMPONENT_NAME2_PROTOCOL gScsiDiskComponentName2
;
86 // action code used in detect media process
88 #define ACTION_NO_ACTION 0x00
89 #define ACTION_READ_CAPACITY 0x01
90 #define ACTION_RETRY_COMMAND_LATER 0x02
92 #define SCSI_COMMAND_VERSION_1 0x01
93 #define SCSI_COMMAND_VERSION_2 0x02
94 #define SCSI_COMMAND_VERSION_3 0x03
98 Test to see if this driver supports ControllerHandle.
100 This service is called by the EFI boot service ConnectController(). In order
101 to make drivers as small as possible, there are a few calling restrictions for
102 this service. ConnectController() must follow these calling restrictions.
103 If any other agent wishes to call Supported() it must also follow these
104 calling restrictions.
106 @param This Protocol instance pointer.
107 @param ControllerHandle Handle of device to test
108 @param RemainingDevicePath Optional parameter use to pick a specific child
111 @retval EFI_SUCCESS This driver supports this device
112 @retval EFI_ALREADY_STARTED This driver is already running on this device
113 @retval other This driver does not support this device
118 ScsiDiskDriverBindingSupported (
119 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
120 IN EFI_HANDLE Controller
,
121 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
125 Start this driver on ControllerHandle.
127 This service is called by the EFI boot service ConnectController(). In order
128 to make drivers as small as possible, there are a few calling restrictions for
129 this service. ConnectController() must follow these calling restrictions. If
130 any other agent wishes to call Start() it must also follow these calling
133 @param This Protocol instance pointer.
134 @param ControllerHandle Handle of device to bind driver to
135 @param RemainingDevicePath Optional parameter use to pick a specific child
138 @retval EFI_SUCCESS This driver is added to ControllerHandle
139 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
140 @retval other This driver does not support this device
145 ScsiDiskDriverBindingStart (
146 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
147 IN EFI_HANDLE Controller
,
148 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
152 Stop this driver on ControllerHandle.
154 This service is called by the EFI boot service DisconnectController().
155 In order to make drivers as small as possible, there are a few calling
156 restrictions for this service. DisconnectController() must follow these
157 calling restrictions. If any other agent wishes to call Stop() it must
158 also follow these calling restrictions.
160 @param This Protocol instance pointer.
161 @param ControllerHandle Handle of device to stop driver on
162 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
163 children is zero stop the entire bus driver.
164 @param ChildHandleBuffer List of Child Handles to Stop.
166 @retval EFI_SUCCESS This driver is removed ControllerHandle
167 @retval other This driver was not removed from this device
172 ScsiDiskDriverBindingStop (
173 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
174 IN EFI_HANDLE Controller
,
175 IN UINTN NumberOfChildren
,
176 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
180 // EFI Component Name Functions
183 Retrieves a Unicode string that is the user readable name of the driver.
185 This function retrieves the user readable name of a driver in the form of a
186 Unicode string. If the driver specified by This has a user readable name in
187 the language specified by Language, then a pointer to the driver name is
188 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
189 by This does not support the language specified by Language,
190 then EFI_UNSUPPORTED is returned.
192 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
193 EFI_COMPONENT_NAME_PROTOCOL instance.
195 @param Language A pointer to a Null-terminated ASCII string
196 array indicating the language. This is the
197 language of the driver name that the caller is
198 requesting, and it must match one of the
199 languages specified in SupportedLanguages. The
200 number of languages supported by a driver is up
201 to the driver writer. Language is specified
202 in RFC 4646 or ISO 639-2 language code format.
204 @param DriverName A pointer to the Unicode string to return.
205 This Unicode string is the name of the
206 driver specified by This in the language
207 specified by Language.
209 @retval EFI_SUCCESS The Unicode string for the Driver specified by
210 This and the language specified by Language was
211 returned in DriverName.
213 @retval EFI_INVALID_PARAMETER Language is NULL.
215 @retval EFI_INVALID_PARAMETER DriverName is NULL.
217 @retval EFI_UNSUPPORTED The driver specified by This does not support
218 the language specified by Language.
223 ScsiDiskComponentNameGetDriverName (
224 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
226 OUT CHAR16
**DriverName
231 Retrieves a Unicode string that is the user readable name of the controller
232 that is being managed by a driver.
234 This function retrieves the user readable name of the controller specified by
235 ControllerHandle and ChildHandle in the form of a Unicode string. If the
236 driver specified by This has a user readable name in the language specified by
237 Language, then a pointer to the controller name is returned in ControllerName,
238 and EFI_SUCCESS is returned. If the driver specified by This is not currently
239 managing the controller specified by ControllerHandle and ChildHandle,
240 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
241 support the language specified by Language, then EFI_UNSUPPORTED is returned.
243 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
244 EFI_COMPONENT_NAME_PROTOCOL instance.
246 @param ControllerHandle The handle of a controller that the driver
247 specified by This is managing. This handle
248 specifies the controller whose name is to be
251 @param ChildHandle The handle of the child controller to retrieve
252 the name of. This is an optional parameter that
253 may be NULL. It will be NULL for device
254 drivers. It will also be NULL for a bus drivers
255 that wish to retrieve the name of the bus
256 controller. It will not be NULL for a bus
257 driver that wishes to retrieve the name of a
260 @param Language A pointer to a Null-terminated ASCII string
261 array indicating the language. This is the
262 language of the driver name that the caller is
263 requesting, and it must match one of the
264 languages specified in SupportedLanguages. The
265 number of languages supported by a driver is up
266 to the driver writer. Language is specified in
267 RFC 4646 or ISO 639-2 language code format.
269 @param ControllerName A pointer to the Unicode string to return.
270 This Unicode string is the name of the
271 controller specified by ControllerHandle and
272 ChildHandle in the language specified by
273 Language from the point of view of the driver
276 @retval EFI_SUCCESS The Unicode string for the user readable name in
277 the language specified by Language for the
278 driver specified by This was returned in
281 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
283 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
286 @retval EFI_INVALID_PARAMETER Language is NULL.
288 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
290 @retval EFI_UNSUPPORTED The driver specified by This is not currently
291 managing the controller specified by
292 ControllerHandle and ChildHandle.
294 @retval EFI_UNSUPPORTED The driver specified by This does not support
295 the language specified by Language.
300 ScsiDiskComponentNameGetControllerName (
301 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
302 IN EFI_HANDLE ControllerHandle
,
303 IN EFI_HANDLE ChildHandle OPTIONAL
,
305 OUT CHAR16
**ControllerName
312 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
313 @param ExtendedVerification The flag about if extend verificate
315 @retval EFI_SUCCESS The device was reset.
316 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
318 @return EFI_STATUS is retured from EFI_SCSI_IO_PROTOCOL.ResetDevice().
324 IN EFI_BLOCK_IO_PROTOCOL
*This
,
325 IN BOOLEAN ExtendedVerification
330 The function is to Read Block from SCSI Disk.
332 @param This The pointer of EFI_BLOCK_IO_PROTOCOL.
333 @param MediaId The Id of Media detected
334 @param Lba The logic block address
335 @param BufferSize The size of Buffer
336 @param Buffer The buffer to fill the read out data
338 @retval EFI_SUCCESS Successfully to read out block.
339 @retval EFI_DEVICE_ERROR Fail to detect media.
340 @retval EFI_NO_MEDIA Media is not present.
341 @retval EFI_MEDIA_CHANGED Media has changed.
342 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
343 @retval EFI_INVALID_PARAMETER Invalid parameter passed in.
349 IN EFI_BLOCK_IO_PROTOCOL
*This
,
358 The function is to Write Block to SCSI Disk.
360 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
361 @param MediaId The Id of Media detected
362 @param Lba The logic block address
363 @param BufferSize The size of Buffer
364 @param Buffer The buffer to fill the read out data
366 @retval EFI_SUCCESS Successfully to read out block.
367 @retval EFI_WRITE_PROTECTED The device can not be written to.
368 @retval EFI_DEVICE_ERROR Fail to detect media.
369 @retval EFI_NO_MEDIA Media is not present.
370 @retval EFI_MEDIA_CHNAGED Media has changed.
371 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
372 @retval EFI_INVALID_PARAMETER Invalid parameter passed in.
377 ScsiDiskWriteBlocks (
378 IN EFI_BLOCK_IO_PROTOCOL
*This
,
389 EFI_SUCCESS is returned directly.
391 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
393 @retval EFI_SUCCESS All outstanding data was written to the device
398 ScsiDiskFlushBlocks (
399 IN EFI_BLOCK_IO_PROTOCOL
*This
404 Provides inquiry information for the controller type.
406 This function is used by the IDE bus driver to get inquiry data. Data format
407 of Identify data is defined by the Interface GUID.
409 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
410 @param[in, out] InquiryData Pointer to a buffer for the inquiry data.
411 @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.
413 @retval EFI_SUCCESS The command was accepted without any errors.
414 @retval EFI_NOT_FOUND Device does not support this data class
415 @retval EFI_DEVICE_ERROR Error reading InquiryData from device
416 @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough
421 ScsiDiskInfoInquiry (
422 IN EFI_DISK_INFO_PROTOCOL
*This
,
423 IN OUT VOID
*InquiryData
,
424 IN OUT UINT32
*InquiryDataSize
429 Provides identify information for the controller type.
431 This function is used by the IDE bus driver to get identify data. Data format
432 of Identify data is defined by the Interface GUID.
434 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL
436 @param[in, out] IdentifyData Pointer to a buffer for the identify data.
437 @param[in, out] IdentifyDataSize Pointer to the value for the identify data
440 @retval EFI_SUCCESS The command was accepted without any errors.
441 @retval EFI_NOT_FOUND Device does not support this data class
442 @retval EFI_DEVICE_ERROR Error reading IdentifyData from device
443 @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough
448 ScsiDiskInfoIdentify (
449 IN EFI_DISK_INFO_PROTOCOL
*This
,
450 IN OUT VOID
*IdentifyData
,
451 IN OUT UINT32
*IdentifyDataSize
456 Provides sense data information for the controller type.
458 This function is used by the IDE bus driver to get sense data.
459 Data format of Sense data is defined by the Interface GUID.
461 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
462 @param[in, out] SenseData Pointer to the SenseData.
463 @param[in, out] SenseDataSize Size of SenseData in bytes.
464 @param[out] SenseDataNumber Pointer to the value for the sense data size.
466 @retval EFI_SUCCESS The command was accepted without any errors.
467 @retval EFI_NOT_FOUND Device does not support this data class.
468 @retval EFI_DEVICE_ERROR Error reading SenseData from device.
469 @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.
474 ScsiDiskInfoSenseData (
475 IN EFI_DISK_INFO_PROTOCOL
*This
,
476 IN OUT VOID
*SenseData
,
477 IN OUT UINT32
*SenseDataSize
,
478 OUT UINT8
*SenseDataNumber
482 This function is used by the IDE bus driver to get controller information.
484 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
485 @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.
486 @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.
488 @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.
489 @retval EFI_UNSUPPORTED This is not an IDE device.
494 ScsiDiskInfoWhichIde (
495 IN EFI_DISK_INFO_PROTOCOL
*This
,
496 OUT UINT32
*IdeChannel
,
497 OUT UINT32
*IdeDevice
502 Detect Device and read out capacity ,if error occurs, parse the sense key.
504 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
505 @param MustReadCapacity The flag about reading device capacity
506 @param MediaChange The pointer of flag indicates if media has changed
508 @retval EFI_DEVICE_ERROR Indicates that error occurs
509 @retval EFI_SUCCESS Successfully to detect media
513 ScsiDiskDetectMedia (
514 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
515 IN BOOLEAN MustReadCapacity
,
516 OUT BOOLEAN
*MediaChange
522 When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;
523 When Test Unit Ready command encounters any error caused by host adapter or
524 target, return error without retrieving Sense Keys.
526 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
527 @param NeedRetry The pointer of flag indicates try again
528 @param SenseDataArray The pointer of an array of sense data
529 @param NumberOfSenseKeys The pointer of the number of sense data array
531 @retval EFI_DEVICE_ERROR Indicates that error occurs
532 @retval EFI_SUCCESS Successfully to test unit
536 ScsiDiskTestUnitReady (
537 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
538 OUT BOOLEAN
*NeedRetry
,
539 OUT EFI_SCSI_SENSE_DATA
**SenseDataArray
,
540 OUT UINTN
*NumberOfSenseKeys
545 Parsing Sense Keys which got from request sense command.
547 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
548 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
549 @param NumberOfSenseKeys The number of sense key
550 @param Action The pointer of action which indicates what is need to do next
552 @retval EFI_DEVICE_ERROR Indicates that error occurs
553 @retval EFI_SUCCESS Successfully to complete the parsing
557 DetectMediaParsingSenseKeys (
558 OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
559 IN EFI_SCSI_SENSE_DATA
*SenseData
,
560 IN UINTN NumberOfSenseKeys
,
566 Send read capacity command to device and get the device parameter.
568 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
569 @param NeedRetry The pointer of flag indicates if need a retry
570 @param SenseDataArray The pointer of an array of sense data
571 @param NumberOfSenseKeys The number of sense key
573 @retval EFI_DEVICE_ERROR Indicates that error occurs
574 @retval EFI_SUCCESS Successfully to read capacity
578 ScsiDiskReadCapacity (
579 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
580 OUT BOOLEAN
*NeedRetry
,
581 OUT EFI_SCSI_SENSE_DATA
**SenseDataArray
,
582 OUT UINTN
*NumberOfSenseKeys
586 Check the HostAdapter status and re-interpret it in EFI_STATUS.
588 @param HostAdapterStatus Host Adapter status
590 @retval EFI_SUCCESS Host adapter is OK.
591 @retval EFI_TIMEOUT Timeout.
592 @retval EFI_NOT_READY Adapter NOT ready.
593 @retval EFI_DEVICE_ERROR Adapter device error.
597 CheckHostAdapterStatus (
598 IN UINT8 HostAdapterStatus
603 Check the target status and re-interpret it in EFI_STATUS.
605 @param TargetStatus Target status
607 @retval EFI_NOT_READY Device is NOT ready.
608 @retval EFI_DEVICE_ERROR
614 IN UINT8 TargetStatus
618 Retrieve all sense keys from the device.
620 When encountering error during the process, if retrieve sense keys before
621 error encountered, it returns the sense keys with return status set to EFI_SUCCESS,
622 and NeedRetry set to FALSE; otherwize, return the proper return status.
624 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
625 @param NeedRetry The pointer of flag indicates if need a retry
626 @param SenseDataArray The pointer of an array of sense data
627 @param NumberOfSenseKeys The number of sense key
628 @param AskResetIfError The flag indicates if need reset when error occurs
630 @retval EFI_DEVICE_ERROR Indicates that error occurs
631 @retval EFI_SUCCESS Successfully to request sense key
635 ScsiDiskRequestSenseKeys (
636 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
637 OUT BOOLEAN
*NeedRetry
,
638 OUT EFI_SCSI_SENSE_DATA
**SenseDataArray
,
639 OUT UINTN
*NumberOfSenseKeys
,
640 IN BOOLEAN AskResetIfError
644 Send out Inquiry command to Device.
646 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
647 @param NeedRetry Indicates if needs try again when error happens
649 @retval EFI_DEVICE_ERROR Indicates that error occurs
650 @retval EFI_SUCCESS Successfully to detect media
654 ScsiDiskInquiryDevice (
655 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
656 OUT BOOLEAN
*NeedRetry
662 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
667 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
671 Read sector from SCSI Disk.
673 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
674 @param Buffer The buffer to fill in the read out data
675 @param Lba Logic block address
676 @param NumberOfBlocks The number of blocks to read
678 @retval EFI_DEVICE_ERROR Indicates a device error.
679 @retval EFI_SUCCESS Operation is successful.
683 ScsiDiskReadSectors (
684 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
687 IN UINTN NumberOfBlocks
691 Write sector to SCSI Disk.
693 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
694 @param Buffer The buffer of data to be written into SCSI Disk
695 @param Lba Logic block address
696 @param NumberOfBlocks The number of blocks to read
698 @retval EFI_DEVICE_ERROR Indicates a device error.
699 @retval EFI_SUCCESS Operation is successful.
703 ScsiDiskWriteSectors (
704 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
707 IN UINTN NumberOfBlocks
713 @param ScsiDiskDevice The pointer of ScsiDiskDevice
714 @param NeedRetry The pointer of flag indicates if needs retry if error happens
715 @param SenseDataArray NOT used yet in this function
716 @param NumberOfSenseKeys The number of sense key
717 @param Timeout The time to complete the command
718 @param DataBuffer The buffer to fill with the read out data
719 @param DataLength The length of buffer
720 @param StartLba The start logic block address
721 @param SectorSize The size of sector
723 @return EFI_STATUS is returned by calling ScsiRead10Command().
727 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
728 OUT BOOLEAN
*NeedRetry
,
729 OUT EFI_SCSI_SENSE_DATA
**SenseDataArray
, OPTIONAL
730 OUT UINTN
*NumberOfSenseKeys
,
732 OUT UINT8
*DataBuffer
,
733 IN OUT UINT32
*DataLength
,
739 Submit Write Command.
741 @param ScsiDiskDevice The pointer of ScsiDiskDevice
742 @param NeedRetry The pointer of flag indicates if needs retry if error happens
743 @param SenseDataArray NOT used yet in this function
744 @param NumberOfSenseKeys The number of sense key
745 @param Timeout The time to complete the command
746 @param DataBuffer The buffer to fill with the read out data
747 @param DataLength The length of buffer
748 @param StartLba The start logic block address
749 @param SectorSize The size of sector
751 @return EFI_STATUS is returned by calling ScsiWrite10Command().
756 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
757 OUT BOOLEAN
*NeedRetry
,
758 OUT EFI_SCSI_SENSE_DATA
**SenseDataArray
, OPTIONAL
759 OUT UINTN
*NumberOfSenseKeys
,
761 IN UINT8
*DataBuffer
,
762 IN OUT UINT32
*DataLength
,
768 Get information from media read capacity command.
770 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
771 @param Capacity10 The pointer of EFI_SCSI_DISK_CAPACITY_DATA
772 @param Capacity16 The pointer of EFI_SCSI_DISK_CAPACITY_DATA16
776 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
777 IN EFI_SCSI_DISK_CAPACITY_DATA
*Capacity10
,
778 IN EFI_SCSI_DISK_CAPACITY_DATA16
*Capacity16
782 Check sense key to find if media presents.
784 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
785 @param SenseCounts The number of sense key
787 @retval TRUE NOT any media
788 @retval FALSE Media presents
792 IN EFI_SCSI_SENSE_DATA
*SenseData
,
799 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
800 @param SenseCounts The number of sense key
803 @retval FALSE NOT error
807 ScsiDiskIsMediaError (
808 IN EFI_SCSI_SENSE_DATA
*SenseData
,
813 Check sense key to find if hardware error happens.
815 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
816 @param SenseCounts The number of sense key
818 @retval TRUE Hardware error exits.
819 @retval FALSE NO error.
823 ScsiDiskIsHardwareError (
824 IN EFI_SCSI_SENSE_DATA
*SenseData
,
829 Check sense key to find if media has changed.
831 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
832 @param SenseCounts The number of sense key
834 @retval TRUE Media is changed.
835 @retval FALSE Medit is NOT changed.
838 ScsiDiskIsMediaChange (
839 IN EFI_SCSI_SENSE_DATA
*SenseData
,
844 Check sense key to find if reset happens.
846 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
847 @param SenseCounts The number of sense key
849 @retval TRUE It is reset before.
850 @retval FALSE It is NOT reset before.
854 ScsiDiskIsResetBefore (
855 IN EFI_SCSI_SENSE_DATA
*SenseData
,
860 Check sense key to find if the drive is ready.
862 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
863 @param SenseCounts The number of sense key
864 @param RetryLater The flag means if need a retry
866 @retval TRUE Drive is ready.
867 @retval FALSE Drive is NOT ready.
871 ScsiDiskIsDriveReady (
872 IN EFI_SCSI_SENSE_DATA
*SenseData
,
873 IN UINTN SenseCounts
,
874 OUT BOOLEAN
*RetryLater
878 Check sense key to find if it has sense key.
880 @param SenseData - The pointer of EFI_SCSI_SENSE_DATA
881 @param SenseCounts - The number of sense key
883 @retval TRUE It has sense key.
884 @retval FALSE It has NOT any sense key.
888 ScsiDiskHaveSenseKey (
889 IN EFI_SCSI_SENSE_DATA
*SenseData
,
894 Release resource about disk device.
896 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
900 ReleaseScsiDiskDeviceResources (
901 IN SCSI_DISK_DEV
*ScsiDiskDevice
905 Determine if Block Io should be produced.
908 @param ChildHandle Child Handle to retrieve Parent information.
910 @retval TRUE Should produce Block Io.
911 @retval FALSE Should not produce Block Io.
915 DetermineInstallBlockIo (
916 IN EFI_HANDLE ChildHandle
920 Initialize the installation of DiskInfo protocol.
922 This function prepares for the installation of DiskInfo protocol on the child handle.
923 By default, it installs DiskInfo protocol with SCSI interface GUID. If it further
924 detects that the physical device is an ATAPI/AHCI device, it then updates interface GUID
925 to be IDE/AHCI interface GUID.
927 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
928 @param ChildHandle Child handle to install DiskInfo protocol.
932 InitializeInstallDiskInfo (
933 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
934 IN EFI_HANDLE ChildHandle
938 Search protocol database and check to see if the protocol
939 specified by ProtocolGuid is present on a ControllerHandle and opened by
940 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
941 If the ControllerHandle is found, then the protocol specified by ProtocolGuid
942 will be opened on it.
945 @param ProtocolGuid ProtocolGuid pointer.
946 @param ChildHandle Child Handle to retrieve Parent information.
952 IN EFI_GUID
*ProtocolGuid
,
953 IN EFI_HANDLE ChildHandle