2 Header file for SCSI Disk Driver.
4 Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
16 #include <Protocol/ScsiIo.h>
17 #include <Protocol/ComponentName.h>
18 #include <Protocol/BlockIo.h>
19 #include <Protocol/BlockIo2.h>
20 #include <Protocol/EraseBlock.h>
21 #include <Protocol/DriverBinding.h>
22 #include <Protocol/ScsiPassThruExt.h>
23 #include <Protocol/ScsiPassThru.h>
24 #include <Protocol/DiskInfo.h>
25 #include <Protocol/StorageSecurityCommand.h>
28 #include <Library/DebugLib.h>
29 #include <Library/UefiDriverEntryPoint.h>
30 #include <Library/UefiLib.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/MemoryAllocationLib.h>
33 #include <Library/UefiScsiLib.h>
34 #include <Library/UefiBootServicesTableLib.h>
35 #include <Library/DevicePathLib.h>
37 #include <IndustryStandard/Scsi.h>
38 #include <IndustryStandard/Atapi.h>
40 #define IS_DEVICE_FIXED(a) (a)->FixedDevice ? 1 : 0
42 #define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
44 #define UFS_WLUN_RPMB 0xC4
49 UINT32 GranularityAlignment
;
50 } SCSI_UNMAP_PARAM_INFO
;
52 #define SCSI_DISK_DEV_SIGNATURE SIGNATURE_32 ('s', 'c', 'd', 'k')
59 EFI_STORAGE_SECURITY_COMMAND_PROTOCOL StorageSecurity
;
61 EFI_BLOCK_IO_PROTOCOL BlkIo
;
62 EFI_BLOCK_IO2_PROTOCOL BlkIo2
;
63 EFI_BLOCK_IO_MEDIA BlkIoMedia
;
64 EFI_ERASE_BLOCK_PROTOCOL EraseBlock
;
65 EFI_SCSI_IO_PROTOCOL
*ScsiIo
;
70 EFI_SCSI_SENSE_DATA
*SenseData
;
71 UINTN SenseDataNumber
;
72 EFI_SCSI_INQUIRY_DATA InquiryData
;
74 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
76 EFI_DISK_INFO_PROTOCOL DiskInfo
;
79 // The following fields are only valid for ATAPI/SATA device
83 ATAPI_IDENTIFY_DATA IdentifyData
;
86 // Scsi UNMAP command parameters information
88 SCSI_UNMAP_PARAM_INFO UnmapInfo
;
89 BOOLEAN BlockLimitsVpdSupported
;
92 // The flag indicates if 16-byte command can be used
97 // The queue for asynchronous task requests
99 LIST_ENTRY AsyncTaskQueue
;
102 #define SCSI_DISK_DEV_FROM_BLKIO(a) CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)
103 #define SCSI_DISK_DEV_FROM_BLKIO2(a) CR (a, SCSI_DISK_DEV, BlkIo2, SCSI_DISK_DEV_SIGNATURE)
104 #define SCSI_DISK_DEV_FROM_ERASEBLK(a) CR (a, SCSI_DISK_DEV, EraseBlock, SCSI_DISK_DEV_SIGNATURE)
105 #define SCSI_DISK_DEV_FROM_STORSEC(a) CR (a, SCSI_DISK_DEV, StorageSecurity, SCSI_DISK_DEV_SIGNATURE)
107 #define SCSI_DISK_DEV_FROM_DISKINFO(a) CR (a, SCSI_DISK_DEV, DiskInfo, SCSI_DISK_DEV_SIGNATURE)
110 // Asynchronous I/O request
113 // Private data structure for a BlockIo2 request
116 EFI_BLOCK_IO2_TOKEN
*Token
;
118 // The flag indicates if the last Scsi Read/Write sub-task for a BlockIo2
119 // request is sent to device
124 // The queue for Scsi Read/Write sub-tasks of a BlockIo2 request
126 LIST_ENTRY ScsiRWQueue
;
129 } SCSI_BLKIO2_REQUEST
;
132 // Private data structure for a SCSI Read/Write request
135 SCSI_DISK_DEV
*ScsiDiskDevice
;
137 EFI_SCSI_SENSE_DATA
*SenseData
;
138 UINT8 SenseDataLength
;
139 UINT8 HostAdapterStatus
;
149 // The BlockIo2 request this SCSI command belongs to
151 SCSI_BLKIO2_REQUEST
*BlkIo2Req
;
154 } SCSI_ASYNC_RW_REQUEST
;
157 // Private data structure for an EraseBlock request
160 EFI_ERASE_BLOCK_TOKEN
*Token
;
162 EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket
;
165 } SCSI_ERASEBLK_REQUEST
;
170 extern EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding
;
171 extern EFI_COMPONENT_NAME_PROTOCOL gScsiDiskComponentName
;
172 extern EFI_COMPONENT_NAME2_PROTOCOL gScsiDiskComponentName2
;
174 // action code used in detect media process
176 #define ACTION_NO_ACTION 0x00
177 #define ACTION_READ_CAPACITY 0x01
178 #define ACTION_RETRY_COMMAND_LATER 0x02
179 #define ACTION_RETRY_WITH_BACKOFF_ALGO 0x03
181 #define SCSI_COMMAND_VERSION_1 0x01
182 #define SCSI_COMMAND_VERSION_2 0x02
183 #define SCSI_COMMAND_VERSION_3 0x03
186 // SCSI Disk Timeout Experience Value
188 // As ScsiDisk and ScsiBus driver are used to manage SCSI or ATAPI devices, the timeout
189 // value is updated to 30s to follow ATA/ATAPI spec in which the device may take up to 30s
190 // to respond command.
192 #define SCSI_DISK_TIMEOUT EFI_TIMER_PERIOD_SECONDS (30)
195 Test to see if this driver supports ControllerHandle.
197 This service is called by the EFI boot service ConnectController(). In order
198 to make drivers as small as possible, there are a few calling restrictions for
199 this service. ConnectController() must follow these calling restrictions.
200 If any other agent wishes to call Supported() it must also follow these
201 calling restrictions.
203 @param This Protocol instance pointer.
204 @param ControllerHandle Handle of device to test
205 @param RemainingDevicePath Optional parameter use to pick a specific child
208 @retval EFI_SUCCESS This driver supports this device
209 @retval EFI_ALREADY_STARTED This driver is already running on this device
210 @retval other This driver does not support this device
215 ScsiDiskDriverBindingSupported (
216 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
217 IN EFI_HANDLE Controller
,
218 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
222 Start this driver on ControllerHandle.
224 This service is called by the EFI boot service ConnectController(). In order
225 to make drivers as small as possible, there are a few calling restrictions for
226 this service. ConnectController() must follow these calling restrictions. If
227 any other agent wishes to call Start() it must also follow these calling
230 @param This Protocol instance pointer.
231 @param ControllerHandle Handle of device to bind driver to
232 @param RemainingDevicePath Optional parameter use to pick a specific child
235 @retval EFI_SUCCESS This driver is added to ControllerHandle
236 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
237 @retval other This driver does not support this device
242 ScsiDiskDriverBindingStart (
243 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
244 IN EFI_HANDLE Controller
,
245 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
249 Stop this driver on ControllerHandle.
251 This service is called by the EFI boot service DisconnectController().
252 In order to make drivers as small as possible, there are a few calling
253 restrictions for this service. DisconnectController() must follow these
254 calling restrictions. If any other agent wishes to call Stop() it must
255 also follow these calling restrictions.
257 @param This Protocol instance pointer.
258 @param ControllerHandle Handle of device to stop driver on
259 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
260 children is zero stop the entire bus driver.
261 @param ChildHandleBuffer List of Child Handles to Stop.
263 @retval EFI_SUCCESS This driver is removed ControllerHandle
264 @retval other This driver was not removed from this device
269 ScsiDiskDriverBindingStop (
270 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
271 IN EFI_HANDLE Controller
,
272 IN UINTN NumberOfChildren
,
273 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
277 // EFI Component Name Functions
280 Retrieves a Unicode string that is the user readable name of the driver.
282 This function retrieves the user readable name of a driver in the form of a
283 Unicode string. If the driver specified by This has a user readable name in
284 the language specified by Language, then a pointer to the driver name is
285 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
286 by This does not support the language specified by Language,
287 then EFI_UNSUPPORTED is returned.
289 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
290 EFI_COMPONENT_NAME_PROTOCOL instance.
292 @param Language A pointer to a Null-terminated ASCII string
293 array indicating the language. This is the
294 language of the driver name that the caller is
295 requesting, and it must match one of the
296 languages specified in SupportedLanguages. The
297 number of languages supported by a driver is up
298 to the driver writer. Language is specified
299 in RFC 4646 or ISO 639-2 language code format.
301 @param DriverName A pointer to the Unicode string to return.
302 This Unicode string is the name of the
303 driver specified by This in the language
304 specified by Language.
306 @retval EFI_SUCCESS The Unicode string for the Driver specified by
307 This and the language specified by Language was
308 returned in DriverName.
310 @retval EFI_INVALID_PARAMETER Language is NULL.
312 @retval EFI_INVALID_PARAMETER DriverName is NULL.
314 @retval EFI_UNSUPPORTED The driver specified by This does not support
315 the language specified by Language.
320 ScsiDiskComponentNameGetDriverName (
321 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
323 OUT CHAR16
**DriverName
328 Retrieves a Unicode string that is the user readable name of the controller
329 that is being managed by a driver.
331 This function retrieves the user readable name of the controller specified by
332 ControllerHandle and ChildHandle in the form of a Unicode string. If the
333 driver specified by This has a user readable name in the language specified by
334 Language, then a pointer to the controller name is returned in ControllerName,
335 and EFI_SUCCESS is returned. If the driver specified by This is not currently
336 managing the controller specified by ControllerHandle and ChildHandle,
337 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
338 support the language specified by Language, then EFI_UNSUPPORTED is returned.
340 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
341 EFI_COMPONENT_NAME_PROTOCOL instance.
343 @param ControllerHandle The handle of a controller that the driver
344 specified by This is managing. This handle
345 specifies the controller whose name is to be
348 @param ChildHandle The handle of the child controller to retrieve
349 the name of. This is an optional parameter that
350 may be NULL. It will be NULL for device
351 drivers. It will also be NULL for a bus drivers
352 that wish to retrieve the name of the bus
353 controller. It will not be NULL for a bus
354 driver that wishes to retrieve the name of a
357 @param Language A pointer to a Null-terminated ASCII string
358 array indicating the language. This is the
359 language of the driver name that the caller is
360 requesting, and it must match one of the
361 languages specified in SupportedLanguages. The
362 number of languages supported by a driver is up
363 to the driver writer. Language is specified in
364 RFC 4646 or ISO 639-2 language code format.
366 @param ControllerName A pointer to the Unicode string to return.
367 This Unicode string is the name of the
368 controller specified by ControllerHandle and
369 ChildHandle in the language specified by
370 Language from the point of view of the driver
373 @retval EFI_SUCCESS The Unicode string for the user readable name in
374 the language specified by Language for the
375 driver specified by This was returned in
378 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
380 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
383 @retval EFI_INVALID_PARAMETER Language is NULL.
385 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
387 @retval EFI_UNSUPPORTED The driver specified by This is not currently
388 managing the controller specified by
389 ControllerHandle and ChildHandle.
391 @retval EFI_UNSUPPORTED The driver specified by This does not support
392 the language specified by Language.
397 ScsiDiskComponentNameGetControllerName (
398 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
399 IN EFI_HANDLE ControllerHandle
,
400 IN EFI_HANDLE ChildHandle OPTIONAL
,
402 OUT CHAR16
**ControllerName
409 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
410 @param ExtendedVerification The flag about if extend verificate
412 @retval EFI_SUCCESS The device was reset.
413 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
415 @return EFI_STATUS is returned from EFI_SCSI_IO_PROTOCOL.ResetDevice().
421 IN EFI_BLOCK_IO_PROTOCOL
*This
,
422 IN BOOLEAN ExtendedVerification
427 The function is to Read Block from SCSI Disk.
429 @param This The pointer of EFI_BLOCK_IO_PROTOCOL.
430 @param MediaId The Id of Media detected
431 @param Lba The logic block address
432 @param BufferSize The size of Buffer
433 @param Buffer The buffer to fill the read out data
435 @retval EFI_SUCCESS Successfully to read out block.
436 @retval EFI_DEVICE_ERROR Fail to detect media.
437 @retval EFI_NO_MEDIA Media is not present.
438 @retval EFI_MEDIA_CHANGED Media has changed.
439 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
440 @retval EFI_INVALID_PARAMETER Invalid parameter passed in.
446 IN EFI_BLOCK_IO_PROTOCOL
*This
,
455 The function is to Write Block to SCSI Disk.
457 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
458 @param MediaId The Id of Media detected
459 @param Lba The logic block address
460 @param BufferSize The size of Buffer
461 @param Buffer The buffer to fill the read out data
463 @retval EFI_SUCCESS Successfully to read out block.
464 @retval EFI_WRITE_PROTECTED The device can not be written to.
465 @retval EFI_DEVICE_ERROR Fail to detect media.
466 @retval EFI_NO_MEDIA Media is not present.
467 @retval EFI_MEDIA_CHANGED Media has changed.
468 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
469 @retval EFI_INVALID_PARAMETER Invalid parameter passed in.
474 ScsiDiskWriteBlocks (
475 IN EFI_BLOCK_IO_PROTOCOL
*This
,
486 EFI_SUCCESS is returned directly.
488 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
490 @retval EFI_SUCCESS All outstanding data was written to the device
495 ScsiDiskFlushBlocks (
496 IN EFI_BLOCK_IO_PROTOCOL
*This
503 @param This The pointer of EFI_BLOCK_IO2_PROTOCOL.
504 @param ExtendedVerification The flag about if extend verificate.
506 @retval EFI_SUCCESS The device was reset.
507 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
509 @return EFI_STATUS is returned from EFI_SCSI_IO_PROTOCOL.ResetDevice().
515 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
516 IN BOOLEAN ExtendedVerification
520 The function is to Read Block from SCSI Disk.
522 @param This The pointer of EFI_BLOCK_IO_PROTOCOL.
523 @param MediaId The Id of Media detected.
524 @param Lba The logic block address.
525 @param Token A pointer to the token associated with the transaction.
526 @param BufferSize The size of Buffer.
527 @param Buffer The buffer to fill the read out data.
529 @retval EFI_SUCCESS The read request was queued if Token-> Event is
530 not NULL. The data was read correctly from the
531 device if theToken-> Event is NULL.
532 @retval EFI_DEVICE_ERROR The device reported an error while attempting
533 to perform the read operation.
534 @retval EFI_NO_MEDIA There is no media in the device.
535 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
536 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of
537 the intrinsic block size of the device.
538 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not
539 valid, or the buffer is not on proper
541 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
547 ScsiDiskReadBlocksEx (
548 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
551 IN OUT EFI_BLOCK_IO2_TOKEN
*Token
,
557 The function is to Write Block to SCSI Disk.
559 @param This The pointer of EFI_BLOCK_IO_PROTOCOL.
560 @param MediaId The Id of Media detected.
561 @param Lba The logic block address.
562 @param Token A pointer to the token associated with the transaction.
563 @param BufferSize The size of Buffer.
564 @param Buffer The buffer to fill the read out data.
566 @retval EFI_SUCCESS The data were written correctly to the device.
567 @retval EFI_WRITE_PROTECTED The device cannot be written to.
568 @retval EFI_NO_MEDIA There is no media in the device.
569 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
570 @retval EFI_DEVICE_ERROR The device reported an error while attempting
571 to perform the write operation.
572 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of
573 the intrinsic block size of the device.
574 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not
575 valid, or the buffer is not on proper
581 ScsiDiskWriteBlocksEx (
582 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
585 IN OUT EFI_BLOCK_IO2_TOKEN
*Token
,
591 Flush the Block Device.
593 @param This Indicates a pointer to the calling context.
594 @param Token A pointer to the token associated with the transaction.
596 @retval EFI_SUCCESS All outstanding data was written to the device.
597 @retval EFI_DEVICE_ERROR The device reported an error while attempting to
599 @retval EFI_WRITE_PROTECTED The device cannot be written to.
600 @retval EFI_NO_MEDIA There is no media in the device.
601 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
606 ScsiDiskFlushBlocksEx (
607 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
608 IN OUT EFI_BLOCK_IO2_TOKEN
*Token
612 Erase a specified number of device blocks.
614 @param[in] This Indicates a pointer to the calling context.
615 @param[in] MediaId The media ID that the erase request is for.
616 @param[in] Lba The starting logical block address to be
617 erased. The caller is responsible for erasing
618 only legitimate locations.
619 @param[in, out] Token A pointer to the token associated with the
621 @param[in] Size The size in bytes to be erased. This must be
622 a multiple of the physical block size of the
625 @retval EFI_SUCCESS The erase request was queued if Event is not
626 NULL. The data was erased correctly to the
627 device if the Event is NULL.to the device.
628 @retval EFI_WRITE_PROTECTED The device cannot be erased due to write
630 @retval EFI_DEVICE_ERROR The device reported an error while attempting
631 to perform the erase operation.
632 @retval EFI_INVALID_PARAMETER The erase request contains LBAs that are not
634 @retval EFI_NO_MEDIA There is no media in the device.
635 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
640 ScsiDiskEraseBlocks (
641 IN EFI_ERASE_BLOCK_PROTOCOL
*This
,
644 IN OUT EFI_ERASE_BLOCK_TOKEN
*Token
,
650 Send a security protocol command to a device that receives data and/or the result
651 of one or more commands sent by SendData.
653 The ReceiveData function sends a security protocol command to the given MediaId.
654 The security protocol command sent is defined by SecurityProtocolId and contains
655 the security protocol specific data SecurityProtocolSpecificData. The function
656 returns the data from the security protocol command in PayloadBuffer.
658 For devices supporting the SCSI command set, the security protocol command is sent
659 using the SECURITY PROTOCOL IN command defined in SPC-4.
661 If PayloadBufferSize is too small to store the available data from the security
662 protocol command, the function shall copy PayloadBufferSize bytes into the
663 PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.
665 If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero,
666 the function shall return EFI_INVALID_PARAMETER.
668 If the given MediaId does not support security protocol commands, the function shall
669 return EFI_UNSUPPORTED. If there is no media in the device, the function returns
670 EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the device,
671 the function returns EFI_MEDIA_CHANGED.
673 If the security protocol fails to complete within the Timeout period, the function
674 shall return EFI_TIMEOUT.
676 If the security protocol command completes without an error, the function shall
677 return EFI_SUCCESS. If the security protocol command completes with an error, the
678 function shall return EFI_DEVICE_ERROR.
680 @param This Indicates a pointer to the calling context.
681 @param MediaId ID of the medium to receive data from.
682 @param Timeout The timeout, in 100ns units, to use for the execution
683 of the security protocol command. A Timeout value of 0
684 means that this function will wait indefinitely for the
685 security protocol command to execute. If Timeout is greater
686 than zero, then this function will return EFI_TIMEOUT if the
687 time required to execute the receive data command is greater than Timeout.
688 @param SecurityProtocolId The value of the "Security Protocol" parameter of
689 the security protocol command to be sent.
690 @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter
691 of the security protocol command to be sent.
692 @param PayloadBufferSize Size in bytes of the payload data buffer.
693 @param PayloadBuffer A pointer to a destination buffer to store the security
694 protocol command specific payload data for the security
695 protocol command. The caller is responsible for having
696 either implicit or explicit ownership of the buffer.
697 @param PayloadTransferSize A pointer to a buffer to store the size in bytes of the
698 data written to the payload data buffer.
700 @retval EFI_SUCCESS The security protocol command completed successfully.
701 @retval EFI_WARN_BUFFER_TOO_SMALL The PayloadBufferSize was too small to store the available
702 data from the device. The PayloadBuffer contains the truncated data.
703 @retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.
704 @retval EFI_DEVICE_ERROR The security protocol command completed with an error.
705 @retval EFI_NO_MEDIA There is no media in the device.
706 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
707 @retval EFI_INVALID_PARAMETER The PayloadBuffer or PayloadTransferSize is NULL and
708 PayloadBufferSize is non-zero.
709 @retval EFI_TIMEOUT A timeout occurred while waiting for the security
710 protocol command to execute.
715 ScsiDiskReceiveData (
716 IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL
*This
,
717 IN UINT32 MediaId OPTIONAL
,
719 IN UINT8 SecurityProtocolId
,
720 IN UINT16 SecurityProtocolSpecificData
,
721 IN UINTN PayloadBufferSize
,
722 OUT VOID
*PayloadBuffer
,
723 OUT UINTN
*PayloadTransferSize
727 Send a security protocol command to a device.
729 The SendData function sends a security protocol command containing the payload
730 PayloadBuffer to the given MediaId. The security protocol command sent is
731 defined by SecurityProtocolId and contains the security protocol specific data
732 SecurityProtocolSpecificData. If the underlying protocol command requires a
733 specific padding for the command payload, the SendData function shall add padding
734 bytes to the command payload to satisfy the padding requirements.
736 For devices supporting the SCSI command set, the security protocol command is sent
737 using the SECURITY PROTOCOL OUT command defined in SPC-4.
739 If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall
740 return EFI_INVALID_PARAMETER.
742 If the given MediaId does not support security protocol commands, the function
743 shall return EFI_UNSUPPORTED. If there is no media in the device, the function
744 returns EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the
745 device, the function returns EFI_MEDIA_CHANGED.
747 If the security protocol fails to complete within the Timeout period, the function
748 shall return EFI_TIMEOUT.
750 If the security protocol command completes without an error, the function shall return
751 EFI_SUCCESS. If the security protocol command completes with an error, the function
752 shall return EFI_DEVICE_ERROR.
754 @param This Indicates a pointer to the calling context.
755 @param MediaId ID of the medium to receive data from.
756 @param Timeout The timeout, in 100ns units, to use for the execution
757 of the security protocol command. A Timeout value of 0
758 means that this function will wait indefinitely for the
759 security protocol command to execute. If Timeout is greater
760 than zero, then this function will return EFI_TIMEOUT if the
761 time required to execute the receive data command is greater than Timeout.
762 @param SecurityProtocolId The value of the "Security Protocol" parameter of
763 the security protocol command to be sent.
764 @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter
765 of the security protocol command to be sent.
766 @param PayloadBufferSize Size in bytes of the payload data buffer.
767 @param PayloadBuffer A pointer to a destination buffer to store the security
768 protocol command specific payload data for the security
771 @retval EFI_SUCCESS The security protocol command completed successfully.
772 @retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.
773 @retval EFI_DEVICE_ERROR The security protocol command completed with an error.
774 @retval EFI_NO_MEDIA There is no media in the device.
775 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
776 @retval EFI_INVALID_PARAMETER The PayloadBuffer is NULL and PayloadBufferSize is non-zero.
777 @retval EFI_TIMEOUT A timeout occurred while waiting for the security
778 protocol command to execute.
784 IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL
*This
,
785 IN UINT32 MediaId OPTIONAL
,
787 IN UINT8 SecurityProtocolId
,
788 IN UINT16 SecurityProtocolSpecificData
,
789 IN UINTN PayloadBufferSize
,
790 OUT VOID
*PayloadBuffer
795 Provides inquiry information for the controller type.
797 This function is used by the IDE bus driver to get inquiry data. Data format
798 of Identify data is defined by the Interface GUID.
800 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
801 @param[in, out] InquiryData Pointer to a buffer for the inquiry data.
802 @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.
804 @retval EFI_SUCCESS The command was accepted without any errors.
805 @retval EFI_NOT_FOUND Device does not support this data class
806 @retval EFI_DEVICE_ERROR Error reading InquiryData from device
807 @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough
812 ScsiDiskInfoInquiry (
813 IN EFI_DISK_INFO_PROTOCOL
*This
,
814 IN OUT VOID
*InquiryData
,
815 IN OUT UINT32
*InquiryDataSize
820 Provides identify information for the controller type.
822 This function is used by the IDE bus driver to get identify data. Data format
823 of Identify data is defined by the Interface GUID.
825 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL
827 @param[in, out] IdentifyData Pointer to a buffer for the identify data.
828 @param[in, out] IdentifyDataSize Pointer to the value for the identify data
831 @retval EFI_SUCCESS The command was accepted without any errors.
832 @retval EFI_NOT_FOUND Device does not support this data class
833 @retval EFI_DEVICE_ERROR Error reading IdentifyData from device
834 @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough
839 ScsiDiskInfoIdentify (
840 IN EFI_DISK_INFO_PROTOCOL
*This
,
841 IN OUT VOID
*IdentifyData
,
842 IN OUT UINT32
*IdentifyDataSize
847 Provides sense data information for the controller type.
849 This function is used by the IDE bus driver to get sense data.
850 Data format of Sense data is defined by the Interface GUID.
852 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
853 @param[in, out] SenseData Pointer to the SenseData.
854 @param[in, out] SenseDataSize Size of SenseData in bytes.
855 @param[out] SenseDataNumber Pointer to the value for the sense data size.
857 @retval EFI_SUCCESS The command was accepted without any errors.
858 @retval EFI_NOT_FOUND Device does not support this data class.
859 @retval EFI_DEVICE_ERROR Error reading SenseData from device.
860 @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.
865 ScsiDiskInfoSenseData (
866 IN EFI_DISK_INFO_PROTOCOL
*This
,
867 IN OUT VOID
*SenseData
,
868 IN OUT UINT32
*SenseDataSize
,
869 OUT UINT8
*SenseDataNumber
873 This function is used by the IDE bus driver to get controller information.
875 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
876 @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.
877 @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.
879 @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.
880 @retval EFI_UNSUPPORTED This is not an IDE device.
885 ScsiDiskInfoWhichIde (
886 IN EFI_DISK_INFO_PROTOCOL
*This
,
887 OUT UINT32
*IdeChannel
,
888 OUT UINT32
*IdeDevice
893 Detect Device and read out capacity ,if error occurs, parse the sense key.
895 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
896 @param MustReadCapacity The flag about reading device capacity
897 @param MediaChange The pointer of flag indicates if media has changed
899 @retval EFI_DEVICE_ERROR Indicates that error occurs
900 @retval EFI_SUCCESS Successfully to detect media
904 ScsiDiskDetectMedia (
905 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
906 IN BOOLEAN MustReadCapacity
,
907 OUT BOOLEAN
*MediaChange
913 When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;
914 When Test Unit Ready command encounters any error caused by host adapter or
915 target, return error without retrieving Sense Keys.
917 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
918 @param NeedRetry The pointer of flag indicates try again
919 @param SenseDataArray The pointer of an array of sense data
920 @param NumberOfSenseKeys The pointer of the number of sense data array
922 @retval EFI_DEVICE_ERROR Indicates that error occurs
923 @retval EFI_SUCCESS Successfully to test unit
927 ScsiDiskTestUnitReady (
928 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
929 OUT BOOLEAN
*NeedRetry
,
930 OUT EFI_SCSI_SENSE_DATA
**SenseDataArray
,
931 OUT UINTN
*NumberOfSenseKeys
936 Parsing Sense Keys which got from request sense command.
938 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
939 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
940 @param NumberOfSenseKeys The number of sense key
941 @param Action The pointer of action which indicates what is need to do next
943 @retval EFI_DEVICE_ERROR Indicates that error occurs
944 @retval EFI_SUCCESS Successfully to complete the parsing
948 DetectMediaParsingSenseKeys (
949 OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
950 IN EFI_SCSI_SENSE_DATA
*SenseData
,
951 IN UINTN NumberOfSenseKeys
,
957 Send read capacity command to device and get the device parameter.
959 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
960 @param NeedRetry The pointer of flag indicates if need a retry
961 @param SenseDataArray The pointer of an array of sense data
962 @param NumberOfSenseKeys The number of sense key
964 @retval EFI_DEVICE_ERROR Indicates that error occurs
965 @retval EFI_SUCCESS Successfully to read capacity
969 ScsiDiskReadCapacity (
970 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
971 OUT BOOLEAN
*NeedRetry
,
972 OUT EFI_SCSI_SENSE_DATA
**SenseDataArray
,
973 OUT UINTN
*NumberOfSenseKeys
977 Check the HostAdapter status and re-interpret it in EFI_STATUS.
979 @param HostAdapterStatus Host Adapter status
981 @retval EFI_SUCCESS Host adapter is OK.
982 @retval EFI_TIMEOUT Timeout.
983 @retval EFI_NOT_READY Adapter NOT ready.
984 @retval EFI_DEVICE_ERROR Adapter device error.
988 CheckHostAdapterStatus (
989 IN UINT8 HostAdapterStatus
994 Check the target status and re-interpret it in EFI_STATUS.
996 @param TargetStatus Target status
998 @retval EFI_NOT_READY Device is NOT ready.
999 @retval EFI_DEVICE_ERROR
1005 IN UINT8 TargetStatus
1009 Retrieve all sense keys from the device.
1011 When encountering error during the process, if retrieve sense keys before
1012 error encountered, it returns the sense keys with return status set to EFI_SUCCESS,
1013 and NeedRetry set to FALSE; otherwise, return the proper return status.
1015 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1016 @param NeedRetry The pointer of flag indicates if need a retry
1017 @param SenseDataArray The pointer of an array of sense data
1018 @param NumberOfSenseKeys The number of sense key
1019 @param AskResetIfError The flag indicates if need reset when error occurs
1021 @retval EFI_DEVICE_ERROR Indicates that error occurs
1022 @retval EFI_SUCCESS Successfully to request sense key
1026 ScsiDiskRequestSenseKeys (
1027 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
1028 OUT BOOLEAN
*NeedRetry
,
1029 OUT EFI_SCSI_SENSE_DATA
**SenseDataArray
,
1030 OUT UINTN
*NumberOfSenseKeys
,
1031 IN BOOLEAN AskResetIfError
1035 Send out Inquiry command to Device.
1037 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1038 @param NeedRetry Indicates if needs try again when error happens
1040 @retval EFI_DEVICE_ERROR Indicates that error occurs
1041 @retval EFI_SUCCESS Successfully to detect media
1045 ScsiDiskInquiryDevice (
1046 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
1047 OUT BOOLEAN
*NeedRetry
1053 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1058 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
1062 Read sector from SCSI Disk.
1064 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1065 @param Buffer The buffer to fill in the read out data
1066 @param Lba Logic block address
1067 @param NumberOfBlocks The number of blocks to read
1069 @retval EFI_DEVICE_ERROR Indicates a device error.
1070 @retval EFI_SUCCESS Operation is successful.
1074 ScsiDiskReadSectors (
1075 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1078 IN UINTN NumberOfBlocks
1082 Write sector to SCSI Disk.
1084 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1085 @param Buffer The buffer of data to be written into SCSI Disk
1086 @param Lba Logic block address
1087 @param NumberOfBlocks The number of blocks to read
1089 @retval EFI_DEVICE_ERROR Indicates a device error.
1090 @retval EFI_SUCCESS Operation is successful.
1094 ScsiDiskWriteSectors (
1095 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1098 IN UINTN NumberOfBlocks
1102 Asynchronously read sector from SCSI Disk.
1104 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
1105 @param Buffer The buffer to fill in the read out data.
1106 @param Lba Logic block address.
1107 @param NumberOfBlocks The number of blocks to read.
1108 @param Token A pointer to the token associated with the
1109 non-blocking read request.
1111 @retval EFI_INVALID_PARAMETER Token is NULL or Token->Event is NULL.
1112 @retval EFI_DEVICE_ERROR Indicates a device error.
1113 @retval EFI_SUCCESS Operation is successful.
1117 ScsiDiskAsyncReadSectors (
1118 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1121 IN UINTN NumberOfBlocks
,
1122 IN EFI_BLOCK_IO2_TOKEN
*Token
1126 Asynchronously write sector to SCSI Disk.
1128 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
1129 @param Buffer The buffer of data to be written into SCSI Disk.
1130 @param Lba Logic block address.
1131 @param NumberOfBlocks The number of blocks to read.
1132 @param Token A pointer to the token associated with the
1133 non-blocking read request.
1135 @retval EFI_INVALID_PARAMETER Token is NULL or Token->Event is NULL
1136 @retval EFI_DEVICE_ERROR Indicates a device error.
1137 @retval EFI_SUCCESS Operation is successful.
1141 ScsiDiskAsyncWriteSectors (
1142 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1145 IN UINTN NumberOfBlocks
,
1146 IN EFI_BLOCK_IO2_TOKEN
*Token
1150 Submit Read(10) command.
1152 @param ScsiDiskDevice The pointer of ScsiDiskDevice
1153 @param NeedRetry The pointer of flag indicates if needs retry if error happens
1154 @param Timeout The time to complete the command
1155 @param DataBuffer The buffer to fill with the read out data
1156 @param DataLength The length of buffer
1157 @param StartLba The start logic block address
1158 @param SectorCount The number of blocks to read
1160 @return EFI_STATUS is returned by calling ScsiRead10Command().
1164 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1165 OUT BOOLEAN
*NeedRetry
,
1167 OUT UINT8
*DataBuffer
,
1168 IN OUT UINT32
*DataLength
,
1170 IN UINT32 SectorCount
1174 Submit Write(10) Command.
1176 @param ScsiDiskDevice The pointer of ScsiDiskDevice
1177 @param NeedRetry The pointer of flag indicates if needs retry if error happens
1178 @param Timeout The time to complete the command
1179 @param DataBuffer The buffer to fill with the read out data
1180 @param DataLength The length of buffer
1181 @param StartLba The start logic block address
1182 @param SectorCount The number of blocks to write
1184 @return EFI_STATUS is returned by calling ScsiWrite10Command().
1189 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1190 OUT BOOLEAN
*NeedRetry
,
1192 IN UINT8
*DataBuffer
,
1193 IN OUT UINT32
*DataLength
,
1195 IN UINT32 SectorCount
1199 Submit Read(16) command.
1201 @param ScsiDiskDevice The pointer of ScsiDiskDevice
1202 @param NeedRetry The pointer of flag indicates if needs retry if error happens
1203 @param Timeout The time to complete the command
1204 @param DataBuffer The buffer to fill with the read out data
1205 @param DataLength The length of buffer
1206 @param StartLba The start logic block address
1207 @param SectorCount The number of blocks to read
1209 @return EFI_STATUS is returned by calling ScsiRead16Command().
1213 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1214 OUT BOOLEAN
*NeedRetry
,
1216 OUT UINT8
*DataBuffer
,
1217 IN OUT UINT32
*DataLength
,
1219 IN UINT32 SectorCount
1223 Submit Write(16) Command.
1225 @param ScsiDiskDevice The pointer of ScsiDiskDevice
1226 @param NeedRetry The pointer of flag indicates if needs retry if error happens
1227 @param Timeout The time to complete the command
1228 @param DataBuffer The buffer to fill with the read out data
1229 @param DataLength The length of buffer
1230 @param StartLba The start logic block address
1231 @param SectorCount The number of blocks to write
1233 @return EFI_STATUS is returned by calling ScsiWrite16Command().
1238 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1239 OUT BOOLEAN
*NeedRetry
,
1241 IN UINT8
*DataBuffer
,
1242 IN OUT UINT32
*DataLength
,
1244 IN UINT32 SectorCount
1248 Submit Async Read(10) command.
1250 @param ScsiDiskDevice The pointer of ScsiDiskDevice.
1251 @param Timeout The time to complete the command.
1252 @param TimesRetry The number of times the command has been retried.
1253 @param DataBuffer The buffer to fill with the read out data.
1254 @param DataLength The length of buffer.
1255 @param StartLba The start logic block address.
1256 @param SectorCount The number of blocks to read.
1257 @param BlkIo2Req The upstream BlockIo2 request.
1258 @param Token The pointer to the token associated with the
1259 non-blocking read request.
1261 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
1263 @return others Status returned by calling
1264 ScsiRead10CommandEx().
1268 ScsiDiskAsyncRead10 (
1269 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1271 IN UINT8 TimesRetry
,
1272 OUT UINT8
*DataBuffer
,
1273 IN UINT32 DataLength
,
1275 IN UINT32 SectorCount
,
1276 IN OUT SCSI_BLKIO2_REQUEST
*BlkIo2Req
,
1277 IN EFI_BLOCK_IO2_TOKEN
*Token
1281 Submit Async Write(10) command.
1283 @param ScsiDiskDevice The pointer of ScsiDiskDevice.
1284 @param Timeout The time to complete the command.
1285 @param TimesRetry The number of times the command has been retried.
1286 @param DataBuffer The buffer contains the data to write.
1287 @param DataLength The length of buffer.
1288 @param StartLba The start logic block address.
1289 @param SectorCount The number of blocks to write.
1290 @param BlkIo2Req The upstream BlockIo2 request.
1291 @param Token The pointer to the token associated with the
1292 non-blocking read request.
1294 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
1296 @return others Status returned by calling
1297 ScsiWrite10CommandEx().
1301 ScsiDiskAsyncWrite10 (
1302 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1304 IN UINT8 TimesRetry
,
1305 IN UINT8
*DataBuffer
,
1306 IN UINT32 DataLength
,
1308 IN UINT32 SectorCount
,
1309 IN OUT SCSI_BLKIO2_REQUEST
*BlkIo2Req
,
1310 IN EFI_BLOCK_IO2_TOKEN
*Token
1314 Submit Async Read(16) command.
1316 @param ScsiDiskDevice The pointer of ScsiDiskDevice.
1317 @param Timeout The time to complete the command.
1318 @param TimesRetry The number of times the command has been retried.
1319 @param DataBuffer The buffer to fill with the read out data.
1320 @param DataLength The length of buffer.
1321 @param StartLba The start logic block address.
1322 @param SectorCount The number of blocks to read.
1323 @param BlkIo2Req The upstream BlockIo2 request.
1324 @param Token The pointer to the token associated with the
1325 non-blocking read request.
1327 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
1329 @return others Status returned by calling
1330 ScsiRead16CommandEx().
1334 ScsiDiskAsyncRead16 (
1335 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1337 IN UINT8 TimesRetry
,
1338 OUT UINT8
*DataBuffer
,
1339 IN UINT32 DataLength
,
1341 IN UINT32 SectorCount
,
1342 IN OUT SCSI_BLKIO2_REQUEST
*BlkIo2Req
,
1343 IN EFI_BLOCK_IO2_TOKEN
*Token
1347 Submit Async Write(16) command.
1349 @param ScsiDiskDevice The pointer of ScsiDiskDevice.
1350 @param Timeout The time to complete the command.
1351 @param TimesRetry The number of times the command has been retried.
1352 @param DataBuffer The buffer contains the data to write.
1353 @param DataLength The length of buffer.
1354 @param StartLba The start logic block address.
1355 @param SectorCount The number of blocks to write.
1356 @param BlkIo2Req The upstream BlockIo2 request.
1357 @param Token The pointer to the token associated with the
1358 non-blocking read request.
1360 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
1362 @return others Status returned by calling
1363 ScsiWrite16CommandEx().
1367 ScsiDiskAsyncWrite16 (
1368 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1370 IN UINT8 TimesRetry
,
1371 IN UINT8
*DataBuffer
,
1372 IN UINT32 DataLength
,
1374 IN UINT32 SectorCount
,
1375 IN OUT SCSI_BLKIO2_REQUEST
*BlkIo2Req
,
1376 IN EFI_BLOCK_IO2_TOKEN
*Token
1380 Get information from media read capacity command.
1382 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1383 @param Capacity10 The pointer of EFI_SCSI_DISK_CAPACITY_DATA
1384 @param Capacity16 The pointer of EFI_SCSI_DISK_CAPACITY_DATA16
1388 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
1389 IN EFI_SCSI_DISK_CAPACITY_DATA
*Capacity10
,
1390 IN EFI_SCSI_DISK_CAPACITY_DATA16
*Capacity16
1394 Check sense key to find if media presents.
1396 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1397 @param SenseCounts The number of sense key
1399 @retval TRUE NOT any media
1400 @retval FALSE Media presents
1404 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1405 IN UINTN SenseCounts
1411 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1412 @param SenseCounts The number of sense key
1415 @retval FALSE NOT error
1419 ScsiDiskIsMediaError (
1420 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1421 IN UINTN SenseCounts
1425 Check sense key to find if hardware error happens.
1427 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1428 @param SenseCounts The number of sense key
1430 @retval TRUE Hardware error exits.
1431 @retval FALSE NO error.
1435 ScsiDiskIsHardwareError (
1436 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1437 IN UINTN SenseCounts
1441 Check sense key to find if media has changed.
1443 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1444 @param SenseCounts The number of sense key
1446 @retval TRUE Media is changed.
1447 @retval FALSE Media is NOT changed.
1450 ScsiDiskIsMediaChange (
1451 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1452 IN UINTN SenseCounts
1456 Check sense key to find if reset happens.
1458 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1459 @param SenseCounts The number of sense key
1461 @retval TRUE It is reset before.
1462 @retval FALSE It is NOT reset before.
1466 ScsiDiskIsResetBefore (
1467 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1468 IN UINTN SenseCounts
1472 Check sense key to find if the drive is ready.
1474 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1475 @param SenseCounts The number of sense key
1476 @param RetryLater The flag means if need a retry
1478 @retval TRUE Drive is ready.
1479 @retval FALSE Drive is NOT ready.
1483 ScsiDiskIsDriveReady (
1484 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1485 IN UINTN SenseCounts
,
1486 OUT BOOLEAN
*RetryLater
1490 Check sense key to find if it has sense key.
1492 @param SenseData - The pointer of EFI_SCSI_SENSE_DATA
1493 @param SenseCounts - The number of sense key
1495 @retval TRUE It has sense key.
1496 @retval FALSE It has NOT any sense key.
1500 ScsiDiskHaveSenseKey (
1501 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1502 IN UINTN SenseCounts
1506 Release resource about disk device.
1508 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1512 ReleaseScsiDiskDeviceResources (
1513 IN SCSI_DISK_DEV
*ScsiDiskDevice
1517 Determine if Block Io should be produced.
1520 @param ChildHandle Child Handle to retrieve Parent information.
1522 @retval TRUE Should produce Block Io.
1523 @retval FALSE Should not produce Block Io.
1527 DetermineInstallBlockIo (
1528 IN EFI_HANDLE ChildHandle
1532 Initialize the installation of DiskInfo protocol.
1534 This function prepares for the installation of DiskInfo protocol on the child handle.
1535 By default, it installs DiskInfo protocol with SCSI interface GUID. If it further
1536 detects that the physical device is an ATAPI/AHCI device, it then updates interface GUID
1537 to be IDE/AHCI interface GUID.
1539 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
1540 @param ChildHandle Child handle to install DiskInfo protocol.
1544 InitializeInstallDiskInfo (
1545 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1546 IN EFI_HANDLE ChildHandle
1550 Search protocol database and check to see if the protocol
1551 specified by ProtocolGuid is present on a ControllerHandle and opened by
1552 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
1553 If the ControllerHandle is found, then the protocol specified by ProtocolGuid
1554 will be opened on it.
1557 @param ProtocolGuid ProtocolGuid pointer.
1558 @param ChildHandle Child Handle to retrieve Parent information.
1564 IN EFI_GUID
*ProtocolGuid
,
1565 IN EFI_HANDLE ChildHandle
1569 Determine if EFI Erase Block Protocol should be produced.
1571 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
1572 @param ChildHandle Handle of device.
1574 @retval TRUE Should produce EFI Erase Block Protocol.
1575 @retval FALSE Should not produce EFI Erase Block Protocol.
1579 DetermineInstallEraseBlock (
1580 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1581 IN EFI_HANDLE ChildHandle
1585 Determine if EFI Storage Security Command Protocol should be produced.
1587 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
1588 @param ChildHandle Handle of device.
1590 @retval TRUE Should produce EFI Storage Security Command Protocol.
1591 @retval FALSE Should not produce EFI Storage Security Command Protocol.
1595 DetermineInstallStorageSecurity (
1596 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1597 IN EFI_HANDLE ChildHandle