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
14 #include <Protocol/ScsiIo.h>
15 #include <Protocol/ComponentName.h>
16 #include <Protocol/BlockIo.h>
17 #include <Protocol/BlockIo2.h>
18 #include <Protocol/EraseBlock.h>
19 #include <Protocol/DriverBinding.h>
20 #include <Protocol/ScsiPassThruExt.h>
21 #include <Protocol/ScsiPassThru.h>
22 #include <Protocol/DiskInfo.h>
23 #include <Protocol/StorageSecurityCommand.h>
25 #include <Library/DebugLib.h>
26 #include <Library/UefiDriverEntryPoint.h>
27 #include <Library/UefiLib.h>
28 #include <Library/BaseMemoryLib.h>
29 #include <Library/MemoryAllocationLib.h>
30 #include <Library/UefiScsiLib.h>
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <Library/DevicePathLib.h>
34 #include <IndustryStandard/Scsi.h>
35 #include <IndustryStandard/Atapi.h>
37 #define IS_DEVICE_FIXED(a) (a)->FixedDevice ? 1 : 0
39 #define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
41 #define UFS_WLUN_RPMB 0xC4
46 UINT32 GranularityAlignment
;
47 } SCSI_UNMAP_PARAM_INFO
;
49 #define SCSI_DISK_DEV_SIGNATURE SIGNATURE_32 ('s', 'c', 'd', 'k')
56 EFI_STORAGE_SECURITY_COMMAND_PROTOCOL StorageSecurity
;
58 EFI_BLOCK_IO_PROTOCOL BlkIo
;
59 EFI_BLOCK_IO2_PROTOCOL BlkIo2
;
60 EFI_BLOCK_IO_MEDIA BlkIoMedia
;
61 EFI_ERASE_BLOCK_PROTOCOL EraseBlock
;
62 EFI_SCSI_IO_PROTOCOL
*ScsiIo
;
67 EFI_SCSI_SENSE_DATA
*SenseData
;
68 UINTN SenseDataNumber
;
69 EFI_SCSI_INQUIRY_DATA InquiryData
;
71 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
73 EFI_DISK_INFO_PROTOCOL DiskInfo
;
76 // The following fields are only valid for ATAPI/SATA device
80 ATAPI_IDENTIFY_DATA IdentifyData
;
83 // Scsi UNMAP command parameters information
85 SCSI_UNMAP_PARAM_INFO UnmapInfo
;
86 BOOLEAN BlockLimitsVpdSupported
;
89 // The flag indicates if 16-byte command can be used
94 // The queue for asynchronous task requests
96 LIST_ENTRY AsyncTaskQueue
;
99 #define SCSI_DISK_DEV_FROM_BLKIO(a) CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)
100 #define SCSI_DISK_DEV_FROM_BLKIO2(a) CR (a, SCSI_DISK_DEV, BlkIo2, SCSI_DISK_DEV_SIGNATURE)
101 #define SCSI_DISK_DEV_FROM_ERASEBLK(a) CR (a, SCSI_DISK_DEV, EraseBlock, SCSI_DISK_DEV_SIGNATURE)
102 #define SCSI_DISK_DEV_FROM_STORSEC(a) CR (a, SCSI_DISK_DEV, StorageSecurity, SCSI_DISK_DEV_SIGNATURE)
104 #define SCSI_DISK_DEV_FROM_DISKINFO(a) CR (a, SCSI_DISK_DEV, DiskInfo, SCSI_DISK_DEV_SIGNATURE)
107 // Asynchronous I/O request
110 // Private data structure for a BlockIo2 request
113 EFI_BLOCK_IO2_TOKEN
*Token
;
115 // The flag indicates if the last Scsi Read/Write sub-task for a BlockIo2
116 // request is sent to device
121 // The queue for Scsi Read/Write sub-tasks of a BlockIo2 request
123 LIST_ENTRY ScsiRWQueue
;
126 } SCSI_BLKIO2_REQUEST
;
129 // Private data structure for a SCSI Read/Write request
132 SCSI_DISK_DEV
*ScsiDiskDevice
;
134 EFI_SCSI_SENSE_DATA
*SenseData
;
135 UINT8 SenseDataLength
;
136 UINT8 HostAdapterStatus
;
146 // The BlockIo2 request this SCSI command belongs to
148 SCSI_BLKIO2_REQUEST
*BlkIo2Req
;
151 } SCSI_ASYNC_RW_REQUEST
;
154 // Private data structure for an EraseBlock request
157 EFI_ERASE_BLOCK_TOKEN
*Token
;
159 EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket
;
162 } SCSI_ERASEBLK_REQUEST
;
167 extern EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding
;
168 extern EFI_COMPONENT_NAME_PROTOCOL gScsiDiskComponentName
;
169 extern EFI_COMPONENT_NAME2_PROTOCOL gScsiDiskComponentName2
;
171 // action code used in detect media process
173 #define ACTION_NO_ACTION 0x00
174 #define ACTION_READ_CAPACITY 0x01
175 #define ACTION_RETRY_COMMAND_LATER 0x02
176 #define ACTION_RETRY_WITH_BACKOFF_ALGO 0x03
178 #define SCSI_COMMAND_VERSION_1 0x01
179 #define SCSI_COMMAND_VERSION_2 0x02
180 #define SCSI_COMMAND_VERSION_3 0x03
183 // SCSI Disk Timeout Experience Value
185 // As ScsiDisk and ScsiBus driver are used to manage SCSI or ATAPI devices, the timeout
186 // value is updated to 30s to follow ATA/ATAPI spec in which the device may take up to 30s
187 // to respond command.
189 #define SCSI_DISK_TIMEOUT EFI_TIMER_PERIOD_SECONDS (30)
192 Test to see if this driver supports ControllerHandle.
194 This service is called by the EFI boot service ConnectController(). In order
195 to make drivers as small as possible, there are a few calling restrictions for
196 this service. ConnectController() must follow these calling restrictions.
197 If any other agent wishes to call Supported() it must also follow these
198 calling restrictions.
200 @param This Protocol instance pointer.
201 @param ControllerHandle Handle of device to test
202 @param RemainingDevicePath Optional parameter use to pick a specific child
205 @retval EFI_SUCCESS This driver supports this device
206 @retval EFI_ALREADY_STARTED This driver is already running on this device
207 @retval other This driver does not support this device
212 ScsiDiskDriverBindingSupported (
213 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
214 IN EFI_HANDLE Controller
,
215 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
219 Start this driver on ControllerHandle.
221 This service is called by the EFI boot service ConnectController(). In order
222 to make drivers as small as possible, there are a few calling restrictions for
223 this service. ConnectController() must follow these calling restrictions. If
224 any other agent wishes to call Start() it must also follow these calling
227 @param This Protocol instance pointer.
228 @param ControllerHandle Handle of device to bind driver to
229 @param RemainingDevicePath Optional parameter use to pick a specific child
232 @retval EFI_SUCCESS This driver is added to ControllerHandle
233 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
234 @retval other This driver does not support this device
239 ScsiDiskDriverBindingStart (
240 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
241 IN EFI_HANDLE Controller
,
242 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
246 Stop this driver on ControllerHandle.
248 This service is called by the EFI boot service DisconnectController().
249 In order to make drivers as small as possible, there are a few calling
250 restrictions for this service. DisconnectController() must follow these
251 calling restrictions. If any other agent wishes to call Stop() it must
252 also follow these calling restrictions.
254 @param This Protocol instance pointer.
255 @param ControllerHandle Handle of device to stop driver on
256 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
257 children is zero stop the entire bus driver.
258 @param ChildHandleBuffer List of Child Handles to Stop.
260 @retval EFI_SUCCESS This driver is removed ControllerHandle
261 @retval other This driver was not removed from this device
266 ScsiDiskDriverBindingStop (
267 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
268 IN EFI_HANDLE Controller
,
269 IN UINTN NumberOfChildren
,
270 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
274 // EFI Component Name Functions
278 Retrieves a Unicode string that is the user readable name of the driver.
280 This function retrieves the user readable name of a driver in the form of a
281 Unicode string. If the driver specified by This has a user readable name in
282 the language specified by Language, then a pointer to the driver name is
283 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
284 by This does not support the language specified by Language,
285 then EFI_UNSUPPORTED is returned.
287 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
288 EFI_COMPONENT_NAME_PROTOCOL instance.
290 @param Language A pointer to a Null-terminated ASCII string
291 array indicating the language. This is the
292 language of the driver name that the caller is
293 requesting, and it must match one of the
294 languages specified in SupportedLanguages. The
295 number of languages supported by a driver is up
296 to the driver writer. Language is specified
297 in RFC 4646 or ISO 639-2 language code format.
299 @param DriverName A pointer to the Unicode string to return.
300 This Unicode string is the name of the
301 driver specified by This in the language
302 specified by Language.
304 @retval EFI_SUCCESS The Unicode string for the Driver specified by
305 This and the language specified by Language was
306 returned in DriverName.
308 @retval EFI_INVALID_PARAMETER Language is NULL.
310 @retval EFI_INVALID_PARAMETER DriverName is NULL.
312 @retval EFI_UNSUPPORTED The driver specified by This does not support
313 the language specified by Language.
318 ScsiDiskComponentNameGetDriverName (
319 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
321 OUT CHAR16
**DriverName
325 Retrieves a Unicode string that is the user readable name of the controller
326 that is being managed by a driver.
328 This function retrieves the user readable name of the controller specified by
329 ControllerHandle and ChildHandle in the form of a Unicode string. If the
330 driver specified by This has a user readable name in the language specified by
331 Language, then a pointer to the controller name is returned in ControllerName,
332 and EFI_SUCCESS is returned. If the driver specified by This is not currently
333 managing the controller specified by ControllerHandle and ChildHandle,
334 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
335 support the language specified by Language, then EFI_UNSUPPORTED is returned.
337 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
338 EFI_COMPONENT_NAME_PROTOCOL instance.
340 @param ControllerHandle The handle of a controller that the driver
341 specified by This is managing. This handle
342 specifies the controller whose name is to be
345 @param ChildHandle The handle of the child controller to retrieve
346 the name of. This is an optional parameter that
347 may be NULL. It will be NULL for device
348 drivers. It will also be NULL for a bus drivers
349 that wish to retrieve the name of the bus
350 controller. It will not be NULL for a bus
351 driver that wishes to retrieve the name of a
354 @param Language A pointer to a Null-terminated ASCII string
355 array indicating the language. This is the
356 language of the driver name that the caller is
357 requesting, and it must match one of the
358 languages specified in SupportedLanguages. The
359 number of languages supported by a driver is up
360 to the driver writer. Language is specified in
361 RFC 4646 or ISO 639-2 language code format.
363 @param ControllerName A pointer to the Unicode string to return.
364 This Unicode string is the name of the
365 controller specified by ControllerHandle and
366 ChildHandle in the language specified by
367 Language from the point of view of the driver
370 @retval EFI_SUCCESS The Unicode string for the user readable name in
371 the language specified by Language for the
372 driver specified by This was returned in
375 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
377 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
380 @retval EFI_INVALID_PARAMETER Language is NULL.
382 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
384 @retval EFI_UNSUPPORTED The driver specified by This is not currently
385 managing the controller specified by
386 ControllerHandle and ChildHandle.
388 @retval EFI_UNSUPPORTED The driver specified by This does not support
389 the language specified by Language.
394 ScsiDiskComponentNameGetControllerName (
395 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
396 IN EFI_HANDLE ControllerHandle
,
397 IN EFI_HANDLE ChildHandle OPTIONAL
,
399 OUT CHAR16
**ControllerName
406 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
407 @param ExtendedVerification The flag about if extend verificate
409 @retval EFI_SUCCESS The device was reset.
410 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
412 @return EFI_STATUS is returned from EFI_SCSI_IO_PROTOCOL.ResetDevice().
418 IN EFI_BLOCK_IO_PROTOCOL
*This
,
419 IN BOOLEAN ExtendedVerification
423 The function is to Read Block from SCSI Disk.
425 @param This The pointer of EFI_BLOCK_IO_PROTOCOL.
426 @param MediaId The Id of Media detected
427 @param Lba The logic block address
428 @param BufferSize The size of Buffer
429 @param Buffer The buffer to fill the read out data
431 @retval EFI_SUCCESS Successfully to read out block.
432 @retval EFI_DEVICE_ERROR Fail to detect media.
433 @retval EFI_NO_MEDIA Media is not present.
434 @retval EFI_MEDIA_CHANGED Media has changed.
435 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
436 @retval EFI_INVALID_PARAMETER Invalid parameter passed in.
442 IN EFI_BLOCK_IO_PROTOCOL
*This
,
450 The function is to Write Block to SCSI Disk.
452 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
453 @param MediaId The Id of Media detected
454 @param Lba The logic block address
455 @param BufferSize The size of Buffer
456 @param Buffer The buffer to fill the read out data
458 @retval EFI_SUCCESS Successfully to read out block.
459 @retval EFI_WRITE_PROTECTED The device can not be written to.
460 @retval EFI_DEVICE_ERROR Fail to detect media.
461 @retval EFI_NO_MEDIA Media is not present.
462 @retval EFI_MEDIA_CHANGED Media has changed.
463 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
464 @retval EFI_INVALID_PARAMETER Invalid parameter passed in.
469 ScsiDiskWriteBlocks (
470 IN EFI_BLOCK_IO_PROTOCOL
*This
,
480 EFI_SUCCESS is returned directly.
482 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
484 @retval EFI_SUCCESS All outstanding data was written to the device
489 ScsiDiskFlushBlocks (
490 IN EFI_BLOCK_IO_PROTOCOL
*This
496 @param This The pointer of EFI_BLOCK_IO2_PROTOCOL.
497 @param ExtendedVerification The flag about if extend verificate.
499 @retval EFI_SUCCESS The device was reset.
500 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
502 @return EFI_STATUS is returned from EFI_SCSI_IO_PROTOCOL.ResetDevice().
508 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
509 IN BOOLEAN ExtendedVerification
513 The function is to Read Block from SCSI Disk.
515 @param This The pointer of EFI_BLOCK_IO_PROTOCOL.
516 @param MediaId The Id of Media detected.
517 @param Lba The logic block address.
518 @param Token A pointer to the token associated with the transaction.
519 @param BufferSize The size of Buffer.
520 @param Buffer The buffer to fill the read out data.
522 @retval EFI_SUCCESS The read request was queued if Token-> Event is
523 not NULL. The data was read correctly from the
524 device if theToken-> Event is NULL.
525 @retval EFI_DEVICE_ERROR The device reported an error while attempting
526 to perform the read operation.
527 @retval EFI_NO_MEDIA There is no media in the device.
528 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
529 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of
530 the intrinsic block size of the device.
531 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not
532 valid, or the buffer is not on proper
534 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
540 ScsiDiskReadBlocksEx (
541 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
544 IN OUT EFI_BLOCK_IO2_TOKEN
*Token
,
550 The function is to Write Block to SCSI Disk.
552 @param This The pointer of EFI_BLOCK_IO_PROTOCOL.
553 @param MediaId The Id of Media detected.
554 @param Lba The logic block address.
555 @param Token A pointer to the token associated with the transaction.
556 @param BufferSize The size of Buffer.
557 @param Buffer The buffer to fill the read out data.
559 @retval EFI_SUCCESS The data were written correctly to the device.
560 @retval EFI_WRITE_PROTECTED The device cannot be written to.
561 @retval EFI_NO_MEDIA There is no media in the device.
562 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
563 @retval EFI_DEVICE_ERROR The device reported an error while attempting
564 to perform the write operation.
565 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of
566 the intrinsic block size of the device.
567 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not
568 valid, or the buffer is not on proper
574 ScsiDiskWriteBlocksEx (
575 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
578 IN OUT EFI_BLOCK_IO2_TOKEN
*Token
,
584 Flush the Block Device.
586 @param This Indicates a pointer to the calling context.
587 @param Token A pointer to the token associated with the transaction.
589 @retval EFI_SUCCESS All outstanding data was written to the device.
590 @retval EFI_DEVICE_ERROR The device reported an error while attempting to
592 @retval EFI_WRITE_PROTECTED The device cannot be written to.
593 @retval EFI_NO_MEDIA There is no media in the device.
594 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
599 ScsiDiskFlushBlocksEx (
600 IN EFI_BLOCK_IO2_PROTOCOL
*This
,
601 IN OUT EFI_BLOCK_IO2_TOKEN
*Token
605 Erase a specified number of device blocks.
607 @param[in] This Indicates a pointer to the calling context.
608 @param[in] MediaId The media ID that the erase request is for.
609 @param[in] Lba The starting logical block address to be
610 erased. The caller is responsible for erasing
611 only legitimate locations.
612 @param[in, out] Token A pointer to the token associated with the
614 @param[in] Size The size in bytes to be erased. This must be
615 a multiple of the physical block size of the
618 @retval EFI_SUCCESS The erase request was queued if Event is not
619 NULL. The data was erased correctly to the
620 device if the Event is NULL.to the device.
621 @retval EFI_WRITE_PROTECTED The device cannot be erased due to write
623 @retval EFI_DEVICE_ERROR The device reported an error while attempting
624 to perform the erase operation.
625 @retval EFI_INVALID_PARAMETER The erase request contains LBAs that are not
627 @retval EFI_NO_MEDIA There is no media in the device.
628 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
633 ScsiDiskEraseBlocks (
634 IN EFI_ERASE_BLOCK_PROTOCOL
*This
,
637 IN OUT EFI_ERASE_BLOCK_TOKEN
*Token
,
642 Send a security protocol command to a device that receives data and/or the result
643 of one or more commands sent by SendData.
645 The ReceiveData function sends a security protocol command to the given MediaId.
646 The security protocol command sent is defined by SecurityProtocolId and contains
647 the security protocol specific data SecurityProtocolSpecificData. The function
648 returns the data from the security protocol command in PayloadBuffer.
650 For devices supporting the SCSI command set, the security protocol command is sent
651 using the SECURITY PROTOCOL IN command defined in SPC-4.
653 If PayloadBufferSize is too small to store the available data from the security
654 protocol command, the function shall copy PayloadBufferSize bytes into the
655 PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.
657 If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero,
658 the function shall return EFI_INVALID_PARAMETER.
660 If the given MediaId does not support security protocol commands, the function shall
661 return EFI_UNSUPPORTED. If there is no media in the device, the function returns
662 EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the device,
663 the function returns EFI_MEDIA_CHANGED.
665 If the security protocol fails to complete within the Timeout period, the function
666 shall return EFI_TIMEOUT.
668 If the security protocol command completes without an error, the function shall
669 return EFI_SUCCESS. If the security protocol command completes with an error, the
670 function shall return EFI_DEVICE_ERROR.
672 @param This Indicates a pointer to the calling context.
673 @param MediaId ID of the medium to receive data from.
674 @param Timeout The timeout, in 100ns units, to use for the execution
675 of the security protocol command. A Timeout value of 0
676 means that this function will wait indefinitely for the
677 security protocol command to execute. If Timeout is greater
678 than zero, then this function will return EFI_TIMEOUT if the
679 time required to execute the receive data command is greater than Timeout.
680 @param SecurityProtocolId The value of the "Security Protocol" parameter of
681 the security protocol command to be sent.
682 @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter
683 of the security protocol command to be sent.
684 @param PayloadBufferSize Size in bytes of the payload data buffer.
685 @param PayloadBuffer A pointer to a destination buffer to store the security
686 protocol command specific payload data for the security
687 protocol command. The caller is responsible for having
688 either implicit or explicit ownership of the buffer.
689 @param PayloadTransferSize A pointer to a buffer to store the size in bytes of the
690 data written to the payload data buffer.
692 @retval EFI_SUCCESS The security protocol command completed successfully.
693 @retval EFI_WARN_BUFFER_TOO_SMALL The PayloadBufferSize was too small to store the available
694 data from the device. The PayloadBuffer contains the truncated data.
695 @retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.
696 @retval EFI_DEVICE_ERROR The security protocol command completed with an error.
697 @retval EFI_NO_MEDIA There is no media in the device.
698 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
699 @retval EFI_INVALID_PARAMETER The PayloadBuffer or PayloadTransferSize is NULL and
700 PayloadBufferSize is non-zero.
701 @retval EFI_TIMEOUT A timeout occurred while waiting for the security
702 protocol command to execute.
707 ScsiDiskReceiveData (
708 IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL
*This
,
709 IN UINT32 MediaId OPTIONAL
,
711 IN UINT8 SecurityProtocolId
,
712 IN UINT16 SecurityProtocolSpecificData
,
713 IN UINTN PayloadBufferSize
,
714 OUT VOID
*PayloadBuffer
,
715 OUT UINTN
*PayloadTransferSize
719 Send a security protocol command to a device.
721 The SendData function sends a security protocol command containing the payload
722 PayloadBuffer to the given MediaId. The security protocol command sent is
723 defined by SecurityProtocolId and contains the security protocol specific data
724 SecurityProtocolSpecificData. If the underlying protocol command requires a
725 specific padding for the command payload, the SendData function shall add padding
726 bytes to the command payload to satisfy the padding requirements.
728 For devices supporting the SCSI command set, the security protocol command is sent
729 using the SECURITY PROTOCOL OUT command defined in SPC-4.
731 If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall
732 return EFI_INVALID_PARAMETER.
734 If the given MediaId does not support security protocol commands, the function
735 shall return EFI_UNSUPPORTED. If there is no media in the device, the function
736 returns EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the
737 device, the function returns EFI_MEDIA_CHANGED.
739 If the security protocol fails to complete within the Timeout period, the function
740 shall return EFI_TIMEOUT.
742 If the security protocol command completes without an error, the function shall return
743 EFI_SUCCESS. If the security protocol command completes with an error, the function
744 shall return EFI_DEVICE_ERROR.
746 @param This Indicates a pointer to the calling context.
747 @param MediaId ID of the medium to receive data from.
748 @param Timeout The timeout, in 100ns units, to use for the execution
749 of the security protocol command. A Timeout value of 0
750 means that this function will wait indefinitely for the
751 security protocol command to execute. If Timeout is greater
752 than zero, then this function will return EFI_TIMEOUT if the
753 time required to execute the receive data command is greater than Timeout.
754 @param SecurityProtocolId The value of the "Security Protocol" parameter of
755 the security protocol command to be sent.
756 @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter
757 of the security protocol command to be sent.
758 @param PayloadBufferSize Size in bytes of the payload data buffer.
759 @param PayloadBuffer A pointer to a destination buffer to store the security
760 protocol command specific payload data for the security
763 @retval EFI_SUCCESS The security protocol command completed successfully.
764 @retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.
765 @retval EFI_DEVICE_ERROR The security protocol command completed with an error.
766 @retval EFI_NO_MEDIA There is no media in the device.
767 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
768 @retval EFI_INVALID_PARAMETER The PayloadBuffer is NULL and PayloadBufferSize is non-zero.
769 @retval EFI_TIMEOUT A timeout occurred while waiting for the security
770 protocol command to execute.
776 IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL
*This
,
777 IN UINT32 MediaId OPTIONAL
,
779 IN UINT8 SecurityProtocolId
,
780 IN UINT16 SecurityProtocolSpecificData
,
781 IN UINTN PayloadBufferSize
,
782 OUT VOID
*PayloadBuffer
786 Provides inquiry information for the controller type.
788 This function is used by the IDE bus driver to get inquiry data. Data format
789 of Identify data is defined by the Interface GUID.
791 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
792 @param[in, out] InquiryData Pointer to a buffer for the inquiry data.
793 @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.
795 @retval EFI_SUCCESS The command was accepted without any errors.
796 @retval EFI_NOT_FOUND Device does not support this data class
797 @retval EFI_DEVICE_ERROR Error reading InquiryData from device
798 @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough
803 ScsiDiskInfoInquiry (
804 IN EFI_DISK_INFO_PROTOCOL
*This
,
805 IN OUT VOID
*InquiryData
,
806 IN OUT UINT32
*InquiryDataSize
810 Provides identify information for the controller type.
812 This function is used by the IDE bus driver to get identify data. Data format
813 of Identify data is defined by the Interface GUID.
815 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL
817 @param[in, out] IdentifyData Pointer to a buffer for the identify data.
818 @param[in, out] IdentifyDataSize Pointer to the value for the identify data
821 @retval EFI_SUCCESS The command was accepted without any errors.
822 @retval EFI_NOT_FOUND Device does not support this data class
823 @retval EFI_DEVICE_ERROR Error reading IdentifyData from device
824 @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough
829 ScsiDiskInfoIdentify (
830 IN EFI_DISK_INFO_PROTOCOL
*This
,
831 IN OUT VOID
*IdentifyData
,
832 IN OUT UINT32
*IdentifyDataSize
836 Provides sense data information for the controller type.
838 This function is used by the IDE bus driver to get sense data.
839 Data format of Sense data is defined by the Interface GUID.
841 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
842 @param[in, out] SenseData Pointer to the SenseData.
843 @param[in, out] SenseDataSize Size of SenseData in bytes.
844 @param[out] SenseDataNumber Pointer to the value for the sense data size.
846 @retval EFI_SUCCESS The command was accepted without any errors.
847 @retval EFI_NOT_FOUND Device does not support this data class.
848 @retval EFI_DEVICE_ERROR Error reading SenseData from device.
849 @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.
854 ScsiDiskInfoSenseData (
855 IN EFI_DISK_INFO_PROTOCOL
*This
,
856 IN OUT VOID
*SenseData
,
857 IN OUT UINT32
*SenseDataSize
,
858 OUT UINT8
*SenseDataNumber
862 This function is used by the IDE bus driver to get controller information.
864 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
865 @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.
866 @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.
868 @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.
869 @retval EFI_UNSUPPORTED This is not an IDE device.
874 ScsiDiskInfoWhichIde (
875 IN EFI_DISK_INFO_PROTOCOL
*This
,
876 OUT UINT32
*IdeChannel
,
877 OUT UINT32
*IdeDevice
881 Detect Device and read out capacity ,if error occurs, parse the sense key.
883 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
884 @param MustReadCapacity The flag about reading device capacity
885 @param MediaChange The pointer of flag indicates if media has changed
887 @retval EFI_DEVICE_ERROR Indicates that error occurs
888 @retval EFI_SUCCESS Successfully to detect media
892 ScsiDiskDetectMedia (
893 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
894 IN BOOLEAN MustReadCapacity
,
895 OUT BOOLEAN
*MediaChange
901 When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;
902 When Test Unit Ready command encounters any error caused by host adapter or
903 target, return error without retrieving Sense Keys.
905 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
906 @param NeedRetry The pointer of flag indicates try again
907 @param SenseDataArray The pointer of an array of sense data
908 @param NumberOfSenseKeys The pointer of the number of sense data array
910 @retval EFI_DEVICE_ERROR Indicates that error occurs
911 @retval EFI_SUCCESS Successfully to test unit
915 ScsiDiskTestUnitReady (
916 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
917 OUT BOOLEAN
*NeedRetry
,
918 OUT EFI_SCSI_SENSE_DATA
**SenseDataArray
,
919 OUT UINTN
*NumberOfSenseKeys
923 Parsing Sense Keys which got from request sense command.
925 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
926 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
927 @param NumberOfSenseKeys The number of sense key
928 @param Action The pointer of action which indicates what is need to do next
930 @retval EFI_DEVICE_ERROR Indicates that error occurs
931 @retval EFI_SUCCESS Successfully to complete the parsing
935 DetectMediaParsingSenseKeys (
936 OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
937 IN EFI_SCSI_SENSE_DATA
*SenseData
,
938 IN UINTN NumberOfSenseKeys
,
943 Send read capacity command to device and get the device parameter.
945 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
946 @param NeedRetry The pointer of flag indicates if need a retry
947 @param SenseDataArray The pointer of an array of sense data
948 @param NumberOfSenseKeys The number of sense key
950 @retval EFI_DEVICE_ERROR Indicates that error occurs
951 @retval EFI_SUCCESS Successfully to read capacity
955 ScsiDiskReadCapacity (
956 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
957 OUT BOOLEAN
*NeedRetry
,
958 OUT EFI_SCSI_SENSE_DATA
**SenseDataArray
,
959 OUT UINTN
*NumberOfSenseKeys
963 Check the HostAdapter status and re-interpret it in EFI_STATUS.
965 @param HostAdapterStatus Host Adapter status
967 @retval EFI_SUCCESS Host adapter is OK.
968 @retval EFI_TIMEOUT Timeout.
969 @retval EFI_NOT_READY Adapter NOT ready.
970 @retval EFI_DEVICE_ERROR Adapter device error.
974 CheckHostAdapterStatus (
975 IN UINT8 HostAdapterStatus
979 Check the target status and re-interpret it in EFI_STATUS.
981 @param TargetStatus Target status
983 @retval EFI_NOT_READY Device is NOT ready.
984 @retval EFI_DEVICE_ERROR
990 IN UINT8 TargetStatus
994 Retrieve all sense keys from the device.
996 When encountering error during the process, if retrieve sense keys before
997 error encountered, it returns the sense keys with return status set to EFI_SUCCESS,
998 and NeedRetry set to FALSE; otherwise, return the proper return status.
1000 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1001 @param NeedRetry The pointer of flag indicates if need a retry
1002 @param SenseDataArray The pointer of an array of sense data
1003 @param NumberOfSenseKeys The number of sense key
1004 @param AskResetIfError The flag indicates if need reset when error occurs
1006 @retval EFI_DEVICE_ERROR Indicates that error occurs
1007 @retval EFI_SUCCESS Successfully to request sense key
1011 ScsiDiskRequestSenseKeys (
1012 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
1013 OUT BOOLEAN
*NeedRetry
,
1014 OUT EFI_SCSI_SENSE_DATA
**SenseDataArray
,
1015 OUT UINTN
*NumberOfSenseKeys
,
1016 IN BOOLEAN AskResetIfError
1020 Send out Inquiry command to Device.
1022 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1023 @param NeedRetry Indicates if needs try again when error happens
1025 @retval EFI_DEVICE_ERROR Indicates that error occurs
1026 @retval EFI_SUCCESS Successfully to detect media
1030 ScsiDiskInquiryDevice (
1031 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
1032 OUT BOOLEAN
*NeedRetry
1038 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1043 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
1047 Read sector from SCSI Disk.
1049 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1050 @param Buffer The buffer to fill in the read out data
1051 @param Lba Logic block address
1052 @param NumberOfBlocks The number of blocks to read
1054 @retval EFI_DEVICE_ERROR Indicates a device error.
1055 @retval EFI_SUCCESS Operation is successful.
1059 ScsiDiskReadSectors (
1060 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1063 IN UINTN NumberOfBlocks
1067 Write sector to SCSI Disk.
1069 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1070 @param Buffer The buffer of data to be written into SCSI Disk
1071 @param Lba Logic block address
1072 @param NumberOfBlocks The number of blocks to read
1074 @retval EFI_DEVICE_ERROR Indicates a device error.
1075 @retval EFI_SUCCESS Operation is successful.
1079 ScsiDiskWriteSectors (
1080 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1083 IN UINTN NumberOfBlocks
1087 Asynchronously read sector from SCSI Disk.
1089 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
1090 @param Buffer The buffer to fill in the read out data.
1091 @param Lba Logic block address.
1092 @param NumberOfBlocks The number of blocks to read.
1093 @param Token A pointer to the token associated with the
1094 non-blocking read request.
1096 @retval EFI_INVALID_PARAMETER Token is NULL or Token->Event is NULL.
1097 @retval EFI_DEVICE_ERROR Indicates a device error.
1098 @retval EFI_SUCCESS Operation is successful.
1102 ScsiDiskAsyncReadSectors (
1103 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1106 IN UINTN NumberOfBlocks
,
1107 IN EFI_BLOCK_IO2_TOKEN
*Token
1111 Asynchronously write sector to SCSI Disk.
1113 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
1114 @param Buffer The buffer of data to be written into SCSI Disk.
1115 @param Lba Logic block address.
1116 @param NumberOfBlocks The number of blocks to read.
1117 @param Token A pointer to the token associated with the
1118 non-blocking read request.
1120 @retval EFI_INVALID_PARAMETER Token is NULL or Token->Event is NULL
1121 @retval EFI_DEVICE_ERROR Indicates a device error.
1122 @retval EFI_SUCCESS Operation is successful.
1126 ScsiDiskAsyncWriteSectors (
1127 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1130 IN UINTN NumberOfBlocks
,
1131 IN EFI_BLOCK_IO2_TOKEN
*Token
1135 Submit Read(10) command.
1137 @param ScsiDiskDevice The pointer of ScsiDiskDevice
1138 @param NeedRetry The pointer of flag indicates if needs retry if error happens
1139 @param Timeout The time to complete the command
1140 @param DataBuffer The buffer to fill with the read out data
1141 @param DataLength The length of buffer
1142 @param StartLba The start logic block address
1143 @param SectorCount The number of blocks to read
1145 @return EFI_STATUS is returned by calling ScsiRead10Command().
1149 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1150 OUT BOOLEAN
*NeedRetry
,
1152 OUT UINT8
*DataBuffer
,
1153 IN OUT UINT32
*DataLength
,
1155 IN UINT32 SectorCount
1159 Submit Write(10) Command.
1161 @param ScsiDiskDevice The pointer of ScsiDiskDevice
1162 @param NeedRetry The pointer of flag indicates if needs retry if error happens
1163 @param Timeout The time to complete the command
1164 @param DataBuffer The buffer to fill with the read out data
1165 @param DataLength The length of buffer
1166 @param StartLba The start logic block address
1167 @param SectorCount The number of blocks to write
1169 @return EFI_STATUS is returned by calling ScsiWrite10Command().
1174 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1175 OUT BOOLEAN
*NeedRetry
,
1177 IN UINT8
*DataBuffer
,
1178 IN OUT UINT32
*DataLength
,
1180 IN UINT32 SectorCount
1184 Submit Read(16) command.
1186 @param ScsiDiskDevice The pointer of ScsiDiskDevice
1187 @param NeedRetry The pointer of flag indicates if needs retry if error happens
1188 @param Timeout The time to complete the command
1189 @param DataBuffer The buffer to fill with the read out data
1190 @param DataLength The length of buffer
1191 @param StartLba The start logic block address
1192 @param SectorCount The number of blocks to read
1194 @return EFI_STATUS is returned by calling ScsiRead16Command().
1198 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1199 OUT BOOLEAN
*NeedRetry
,
1201 OUT UINT8
*DataBuffer
,
1202 IN OUT UINT32
*DataLength
,
1204 IN UINT32 SectorCount
1208 Submit Write(16) Command.
1210 @param ScsiDiskDevice The pointer of ScsiDiskDevice
1211 @param NeedRetry The pointer of flag indicates if needs retry if error happens
1212 @param Timeout The time to complete the command
1213 @param DataBuffer The buffer to fill with the read out data
1214 @param DataLength The length of buffer
1215 @param StartLba The start logic block address
1216 @param SectorCount The number of blocks to write
1218 @return EFI_STATUS is returned by calling ScsiWrite16Command().
1223 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1224 OUT BOOLEAN
*NeedRetry
,
1226 IN UINT8
*DataBuffer
,
1227 IN OUT UINT32
*DataLength
,
1229 IN UINT32 SectorCount
1233 Submit Async Read(10) command.
1235 @param ScsiDiskDevice The pointer of ScsiDiskDevice.
1236 @param Timeout The time to complete the command.
1237 @param TimesRetry The number of times the command has been retried.
1238 @param DataBuffer The buffer to fill with the read out data.
1239 @param DataLength The length of buffer.
1240 @param StartLba The start logic block address.
1241 @param SectorCount The number of blocks to read.
1242 @param BlkIo2Req The upstream BlockIo2 request.
1243 @param Token The pointer to the token associated with the
1244 non-blocking read request.
1246 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
1248 @return others Status returned by calling
1249 ScsiRead10CommandEx().
1253 ScsiDiskAsyncRead10 (
1254 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1256 IN UINT8 TimesRetry
,
1257 OUT UINT8
*DataBuffer
,
1258 IN UINT32 DataLength
,
1260 IN UINT32 SectorCount
,
1261 IN OUT SCSI_BLKIO2_REQUEST
*BlkIo2Req
,
1262 IN EFI_BLOCK_IO2_TOKEN
*Token
1266 Submit Async Write(10) command.
1268 @param ScsiDiskDevice The pointer of ScsiDiskDevice.
1269 @param Timeout The time to complete the command.
1270 @param TimesRetry The number of times the command has been retried.
1271 @param DataBuffer The buffer contains the data to write.
1272 @param DataLength The length of buffer.
1273 @param StartLba The start logic block address.
1274 @param SectorCount The number of blocks to write.
1275 @param BlkIo2Req The upstream BlockIo2 request.
1276 @param Token The pointer to the token associated with the
1277 non-blocking read request.
1279 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
1281 @return others Status returned by calling
1282 ScsiWrite10CommandEx().
1286 ScsiDiskAsyncWrite10 (
1287 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1289 IN UINT8 TimesRetry
,
1290 IN UINT8
*DataBuffer
,
1291 IN UINT32 DataLength
,
1293 IN UINT32 SectorCount
,
1294 IN OUT SCSI_BLKIO2_REQUEST
*BlkIo2Req
,
1295 IN EFI_BLOCK_IO2_TOKEN
*Token
1299 Submit Async Read(16) command.
1301 @param ScsiDiskDevice The pointer of ScsiDiskDevice.
1302 @param Timeout The time to complete the command.
1303 @param TimesRetry The number of times the command has been retried.
1304 @param DataBuffer The buffer to fill with the read out data.
1305 @param DataLength The length of buffer.
1306 @param StartLba The start logic block address.
1307 @param SectorCount The number of blocks to read.
1308 @param BlkIo2Req The upstream BlockIo2 request.
1309 @param Token The pointer to the token associated with the
1310 non-blocking read request.
1312 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
1314 @return others Status returned by calling
1315 ScsiRead16CommandEx().
1319 ScsiDiskAsyncRead16 (
1320 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1322 IN UINT8 TimesRetry
,
1323 OUT UINT8
*DataBuffer
,
1324 IN UINT32 DataLength
,
1326 IN UINT32 SectorCount
,
1327 IN OUT SCSI_BLKIO2_REQUEST
*BlkIo2Req
,
1328 IN EFI_BLOCK_IO2_TOKEN
*Token
1332 Submit Async Write(16) command.
1334 @param ScsiDiskDevice The pointer of ScsiDiskDevice.
1335 @param Timeout The time to complete the command.
1336 @param TimesRetry The number of times the command has been retried.
1337 @param DataBuffer The buffer contains the data to write.
1338 @param DataLength The length of buffer.
1339 @param StartLba The start logic block address.
1340 @param SectorCount The number of blocks to write.
1341 @param BlkIo2Req The upstream BlockIo2 request.
1342 @param Token The pointer to the token associated with the
1343 non-blocking read request.
1345 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
1347 @return others Status returned by calling
1348 ScsiWrite16CommandEx().
1352 ScsiDiskAsyncWrite16 (
1353 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1355 IN UINT8 TimesRetry
,
1356 IN UINT8
*DataBuffer
,
1357 IN UINT32 DataLength
,
1359 IN UINT32 SectorCount
,
1360 IN OUT SCSI_BLKIO2_REQUEST
*BlkIo2Req
,
1361 IN EFI_BLOCK_IO2_TOKEN
*Token
1365 Get information from media read capacity command.
1367 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1368 @param Capacity10 The pointer of EFI_SCSI_DISK_CAPACITY_DATA
1369 @param Capacity16 The pointer of EFI_SCSI_DISK_CAPACITY_DATA16
1373 IN OUT SCSI_DISK_DEV
*ScsiDiskDevice
,
1374 IN EFI_SCSI_DISK_CAPACITY_DATA
*Capacity10
,
1375 IN EFI_SCSI_DISK_CAPACITY_DATA16
*Capacity16
1379 Check sense key to find if media presents.
1381 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1382 @param SenseCounts The number of sense key
1384 @retval TRUE NOT any media
1385 @retval FALSE Media presents
1389 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1390 IN UINTN SenseCounts
1396 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1397 @param SenseCounts The number of sense key
1400 @retval FALSE NOT error
1404 ScsiDiskIsMediaError (
1405 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1406 IN UINTN SenseCounts
1410 Check sense key to find if hardware error happens.
1412 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1413 @param SenseCounts The number of sense key
1415 @retval TRUE Hardware error exits.
1416 @retval FALSE NO error.
1420 ScsiDiskIsHardwareError (
1421 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1422 IN UINTN SenseCounts
1426 Check sense key to find if media has changed.
1428 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1429 @param SenseCounts The number of sense key
1431 @retval TRUE Media is changed.
1432 @retval FALSE Media is NOT changed.
1435 ScsiDiskIsMediaChange (
1436 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1437 IN UINTN SenseCounts
1441 Check sense key to find if reset happens.
1443 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1444 @param SenseCounts The number of sense key
1446 @retval TRUE It is reset before.
1447 @retval FALSE It is NOT reset before.
1451 ScsiDiskIsResetBefore (
1452 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1453 IN UINTN SenseCounts
1457 Check sense key to find if the drive is ready.
1459 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1460 @param SenseCounts The number of sense key
1461 @param RetryLater The flag means if need a retry
1463 @retval TRUE Drive is ready.
1464 @retval FALSE Drive is NOT ready.
1468 ScsiDiskIsDriveReady (
1469 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1470 IN UINTN SenseCounts
,
1471 OUT BOOLEAN
*RetryLater
1475 Check sense key to find if it has sense key.
1477 @param SenseData - The pointer of EFI_SCSI_SENSE_DATA
1478 @param SenseCounts - The number of sense key
1480 @retval TRUE It has sense key.
1481 @retval FALSE It has NOT any sense key.
1485 ScsiDiskHaveSenseKey (
1486 IN EFI_SCSI_SENSE_DATA
*SenseData
,
1487 IN UINTN SenseCounts
1491 Release resource about disk device.
1493 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1497 ReleaseScsiDiskDeviceResources (
1498 IN SCSI_DISK_DEV
*ScsiDiskDevice
1502 Determine if Block Io should be produced.
1505 @param ChildHandle Child Handle to retrieve Parent information.
1507 @retval TRUE Should produce Block Io.
1508 @retval FALSE Should not produce Block Io.
1512 DetermineInstallBlockIo (
1513 IN EFI_HANDLE ChildHandle
1517 Initialize the installation of DiskInfo protocol.
1519 This function prepares for the installation of DiskInfo protocol on the child handle.
1520 By default, it installs DiskInfo protocol with SCSI interface GUID. If it further
1521 detects that the physical device is an ATAPI/AHCI device, it then updates interface GUID
1522 to be IDE/AHCI interface GUID.
1524 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
1525 @param ChildHandle Child handle to install DiskInfo protocol.
1529 InitializeInstallDiskInfo (
1530 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1531 IN EFI_HANDLE ChildHandle
1535 Search protocol database and check to see if the protocol
1536 specified by ProtocolGuid is present on a ControllerHandle and opened by
1537 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
1538 If the ControllerHandle is found, then the protocol specified by ProtocolGuid
1539 will be opened on it.
1542 @param ProtocolGuid ProtocolGuid pointer.
1543 @param ChildHandle Child Handle to retrieve Parent information.
1549 IN EFI_GUID
*ProtocolGuid
,
1550 IN EFI_HANDLE ChildHandle
1554 Determine if EFI Erase Block Protocol should be produced.
1556 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
1557 @param ChildHandle Handle of device.
1559 @retval TRUE Should produce EFI Erase Block Protocol.
1560 @retval FALSE Should not produce EFI Erase Block Protocol.
1564 DetermineInstallEraseBlock (
1565 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1566 IN EFI_HANDLE ChildHandle
1570 Determine if EFI Storage Security Command Protocol should be produced.
1572 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
1573 @param ChildHandle Handle of device.
1575 @retval TRUE Should produce EFI Storage Security Command Protocol.
1576 @retval FALSE Should not produce EFI Storage Security Command Protocol.
1580 DetermineInstallStorageSecurity (
1581 IN SCSI_DISK_DEV
*ScsiDiskDevice
,
1582 IN EFI_HANDLE ChildHandle