2 Private Include file for IdeBus PEIM.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _RECOVERY_ATAPI_H_
11 #define _RECOVERY_ATAPI_H_
15 #include <Ppi/BlockIo.h>
16 #include <Ppi/BlockIo2.h>
17 #include <Ppi/AtaController.h>
19 #include <Library/DebugLib.h>
20 #include <Library/TimerLib.h>
21 #include <Library/PeimEntryPoint.h>
22 #include <Library/PeiServicesLib.h>
23 #include <Library/BaseMemoryLib.h>
24 #include <Library/IoLib.h>
25 #include <Library/PeiServicesTablePointerLib.h>
26 #include <Library/MemoryAllocationLib.h>
27 #include <Library/PcdLib.h>
30 #include <IndustryStandard/Atapi.h>
32 #define MAX_SENSE_KEY_COUNT 6
33 #define MAX_IDE_CHANNELS 4 // Ide and Sata Primary, Secondary Channel.
34 #define MAX_IDE_DEVICES 8 // Ide, Sata Primary, Secondary and Master, Slave device.
52 UINT16 Command
; /* when write */
53 UINT16 Status
; /* when read */
57 UINT16 Error
; /* when read */
58 UINT16 Feature
; /* when write */
59 } IDE_ERROR_OR_FEATURE
;
62 UINT16 AltStatus
; /* when read */
63 UINT16 DeviceControl
; /* when write */
64 } IDE_ALTSTATUS_OR_DEVICECONTROL
;
71 IDE_ERROR_OR_FEATURE Reg1
;
77 IDE_CMD_OR_STATUS Reg
;
79 IDE_ALTSTATUS_OR_DEVICECONTROL Alt
;
86 EFI_PEI_BLOCK_IO_MEDIA MediaInfo
;
87 EFI_PEI_BLOCK_IO2_MEDIA MediaInfo2
;
89 } PEI_ATAPI_DEVICE_INFO
;
91 #define ATAPI_BLK_IO_DEV_SIGNATURE SIGNATURE_32 ('a', 'b', 'i', 'o')
95 EFI_PEI_RECOVERY_BLOCK_IO_PPI AtapiBlkIo
;
96 EFI_PEI_RECOVERY_BLOCK_IO2_PPI AtapiBlkIo2
;
97 EFI_PEI_PPI_DESCRIPTOR PpiDescriptor
;
98 EFI_PEI_PPI_DESCRIPTOR PpiDescriptor2
;
99 PEI_ATA_CONTROLLER_PPI
*AtaControllerPpi
;
102 PEI_ATAPI_DEVICE_INFO DeviceInfo
[MAX_IDE_DEVICES
]; //for max 8 device
103 IDE_BASE_REGISTERS IdeIoPortReg
[MAX_IDE_CHANNELS
]; //for max 4 channel.
106 #define PEI_RECOVERY_ATAPI_FROM_BLKIO_THIS(a) CR (a, ATAPI_BLK_IO_DEV, AtapiBlkIo, ATAPI_BLK_IO_DEV_SIGNATURE)
107 #define PEI_RECOVERY_ATAPI_FROM_BLKIO2_THIS(a) CR (a, ATAPI_BLK_IO_DEV, AtapiBlkIo2, ATAPI_BLK_IO_DEV_SIGNATURE)
110 #define STALL_1_MILLI_SECOND 1000 // stall 1 ms
111 #define STALL_1_SECONDS 1000 * STALL_1_MILLI_SECOND
114 // Time Out Value For IDE Device Polling
116 // ATATIMEOUT is used for waiting time out for ATA device
118 #define ATATIMEOUT 1000 // 1 second
119 // ATAPITIMEOUT is used for waiting operation
120 // except read and write time out for ATAPI device
122 #define ATAPITIMEOUT 1000 // 1 second
123 // ATAPILONGTIMEOUT is used for waiting read and
124 // write operation timeout for ATAPI device
126 #define CDROMLONGTIMEOUT 2000 // 2 seconds
127 #define ATAPILONGTIMEOUT 5000 // 5 seconds
130 // PEI Recovery Block I/O PPI
134 Gets the count of block I/O devices that one specific block driver detects.
136 This function is used for getting the count of block I/O devices that one
137 specific block driver detects. To the PEI ATAPI driver, it returns the number
138 of all the detected ATAPI devices it detects during the enumeration process.
139 To the PEI legacy floppy driver, it returns the number of all the legacy
140 devices it finds during its enumeration process. If no device is detected,
141 then the function will return zero.
143 @param[in] PeiServices General-purpose services that are available
145 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI
147 @param[out] NumberBlockDevices The number of block I/O devices discovered.
149 @retval EFI_SUCCESS Operation performed successfully.
154 AtapiGetNumberOfBlockDevices (
155 IN EFI_PEI_SERVICES
**PeiServices
,
156 IN EFI_PEI_RECOVERY_BLOCK_IO_PPI
*This
,
157 OUT UINTN
*NumberBlockDevices
161 Gets a block device's media information.
163 This function will provide the caller with the specified block device's media
164 information. If the media changes, calling this function will update the media
165 information accordingly.
167 @param[in] PeiServices General-purpose services that are available to every
169 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.
170 @param[in] DeviceIndex Specifies the block device to which the function wants
171 to talk. Because the driver that implements Block I/O
172 PPIs will manage multiple block devices, the PPIs that
173 want to talk to a single device must specify the
174 device index that was assigned during the enumeration
175 process. This index is a number from one to
177 @param[out] MediaInfo The media information of the specified block media.
178 The caller is responsible for the ownership of this
181 @retval EFI_SUCCESS Media information about the specified block device
182 was obtained successfully.
183 @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware
185 @retval Others Other failure occurs.
190 AtapiGetBlockDeviceMediaInfo (
191 IN EFI_PEI_SERVICES
**PeiServices
,
192 IN EFI_PEI_RECOVERY_BLOCK_IO_PPI
*This
,
193 IN UINTN DeviceIndex
,
194 OUT EFI_PEI_BLOCK_IO_MEDIA
*MediaInfo
198 Reads the requested number of blocks from the specified block device.
200 The function reads the requested number of blocks from the device. All the
201 blocks are read, or an error is returned. If there is no media in the device,
202 the function returns EFI_NO_MEDIA.
204 @param[in] PeiServices General-purpose services that are available to
206 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.
207 @param[in] DeviceIndex Specifies the block device to which the function wants
208 to talk. Because the driver that implements Block I/O
209 PPIs will manage multiple block devices, the PPIs that
210 want to talk to a single device must specify the device
211 index that was assigned during the enumeration process.
212 This index is a number from one to NumberBlockDevices.
213 @param[in] StartLBA The starting logical block address (LBA) to read from
215 @param[in] BufferSize The size of the Buffer in bytes. This number must be
216 a multiple of the intrinsic block size of the device.
217 @param[out] Buffer A pointer to the destination buffer for the data.
218 The caller is responsible for the ownership of the
221 @retval EFI_SUCCESS The data was read correctly from the device.
222 @retval EFI_DEVICE_ERROR The device reported an error while attempting
223 to perform the read operation.
224 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not
225 valid, or the buffer is not properly aligned.
226 @retval EFI_NO_MEDIA There is no media in the device.
227 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of
228 the intrinsic block size of the device.
234 IN EFI_PEI_SERVICES
**PeiServices
,
235 IN EFI_PEI_RECOVERY_BLOCK_IO_PPI
*This
,
236 IN UINTN DeviceIndex
,
237 IN EFI_PEI_LBA StartLBA
,
243 Gets the count of block I/O devices that one specific block driver detects.
245 This function is used for getting the count of block I/O devices that one
246 specific block driver detects. To the PEI ATAPI driver, it returns the number
247 of all the detected ATAPI devices it detects during the enumeration process.
248 To the PEI legacy floppy driver, it returns the number of all the legacy
249 devices it finds during its enumeration process. If no device is detected,
250 then the function will return zero.
252 @param[in] PeiServices General-purpose services that are available
254 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI
256 @param[out] NumberBlockDevices The number of block I/O devices discovered.
258 @retval EFI_SUCCESS Operation performed successfully.
263 AtapiGetNumberOfBlockDevices2 (
264 IN EFI_PEI_SERVICES
**PeiServices
,
265 IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI
*This
,
266 OUT UINTN
*NumberBlockDevices
270 Gets a block device's media information.
272 This function will provide the caller with the specified block device's media
273 information. If the media changes, calling this function will update the media
274 information accordingly.
276 @param[in] PeiServices General-purpose services that are available to every
278 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.
279 @param[in] DeviceIndex Specifies the block device to which the function wants
280 to talk. Because the driver that implements Block I/O
281 PPIs will manage multiple block devices, the PPIs that
282 want to talk to a single device must specify the
283 device index that was assigned during the enumeration
284 process. This index is a number from one to
286 @param[out] MediaInfo The media information of the specified block media.
287 The caller is responsible for the ownership of this
290 @retval EFI_SUCCESS Media information about the specified block device
291 was obtained successfully.
292 @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware
294 @retval Others Other failure occurs.
299 AtapiGetBlockDeviceMediaInfo2 (
300 IN EFI_PEI_SERVICES
**PeiServices
,
301 IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI
*This
,
302 IN UINTN DeviceIndex
,
303 OUT EFI_PEI_BLOCK_IO2_MEDIA
*MediaInfo
307 Reads the requested number of blocks from the specified block device.
309 The function reads the requested number of blocks from the device. All the
310 blocks are read, or an error is returned. If there is no media in the device,
311 the function returns EFI_NO_MEDIA.
313 @param[in] PeiServices General-purpose services that are available to
315 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.
316 @param[in] DeviceIndex Specifies the block device to which the function wants
317 to talk. Because the driver that implements Block I/O
318 PPIs will manage multiple block devices, the PPIs that
319 want to talk to a single device must specify the device
320 index that was assigned during the enumeration process.
321 This index is a number from one to NumberBlockDevices.
322 @param[in] StartLBA The starting logical block address (LBA) to read from
324 @param[in] BufferSize The size of the Buffer in bytes. This number must be
325 a multiple of the intrinsic block size of the device.
326 @param[out] Buffer A pointer to the destination buffer for the data.
327 The caller is responsible for the ownership of the
330 @retval EFI_SUCCESS The data was read correctly from the device.
331 @retval EFI_DEVICE_ERROR The device reported an error while attempting
332 to perform the read operation.
333 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not
334 valid, or the buffer is not properly aligned.
335 @retval EFI_NO_MEDIA There is no media in the device.
336 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of
337 the intrinsic block size of the device.
343 IN EFI_PEI_SERVICES
**PeiServices
,
344 IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI
*This
,
345 IN UINTN DeviceIndex
,
346 IN EFI_PEI_LBA StartLBA
,
352 // Internal functions
356 Enumerate Atapi devices.
358 This function is used to enumerate Atatpi device in Ide channel.
360 @param[in] AtapiBlkIoDev A pointer to atapi block IO device
364 AtapiEnumerateDevices (
365 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
369 Detect Atapi devices.
371 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
372 @param[in] DevicePosition An integer to signify device position.
373 @param[out] MediaInfo The media information of the specified block media.
374 @param[out] MediaInfo2 The media information 2 of the specified block media.
376 @retval TRUE Atapi device exists in specified position.
377 @retval FALSE Atapi device does not exist in specified position.
381 DiscoverAtapiDevice (
382 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
383 IN UINTN DevicePosition
,
384 OUT EFI_PEI_BLOCK_IO_MEDIA
*MediaInfo
,
385 OUT EFI_PEI_BLOCK_IO2_MEDIA
*MediaInfo2
389 Detect if an IDE controller exists in specified position.
391 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
392 @param[in] DevicePosition An integer to signify device position.
394 @retval TRUE The Atapi device exists.
395 @retval FALSE The Atapi device does not present.
399 DetectIDEController (
400 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
401 IN UINTN DevicePosition
405 Wait specified time interval to poll for BSY bit clear in the Status Register.
407 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
408 @param[in] IdeIoRegisters A pointer to IDE IO registers.
409 @param[in] TimeoutInMilliSeconds Time specified in milliseconds.
411 @retval EFI_SUCCESS BSY bit is cleared in the specified time interval.
412 @retval EFI_TIMEOUT BSY bit is not cleared in the specified time interval.
417 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
418 IN IDE_BASE_REGISTERS
*IdeIoRegisters
,
419 IN UINTN TimeoutInMilliSeconds
423 Wait specified time interval to poll for DRDY bit set in the Status register.
425 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
426 @param[in] IdeIoRegisters A pointer to IDE IO registers.
427 @param[in] TimeoutInMilliSeconds Time specified in milliseconds.
429 @retval EFI_SUCCESS DRDY bit is set in the specified time interval.
430 @retval EFI_TIMEOUT DRDY bit is not set in the specified time interval.
435 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
436 IN IDE_BASE_REGISTERS
*IdeIoRegisters
,
437 IN UINTN TimeoutInMilliSeconds
441 Wait specified time interval to poll for DRQ bit clear in the Status Register.
443 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
444 @param[in] IdeIoRegisters A pointer to IDE IO registers.
445 @param[in] TimeoutInMilliSeconds Time specified in milliseconds.
447 @retval EFI_SUCCESS DRQ bit is cleared in the specified time interval.
448 @retval EFI_TIMEOUT DRQ bit is not cleared in the specified time interval.
453 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
454 IN IDE_BASE_REGISTERS
*IdeIoRegisters
,
455 IN UINTN TimeoutInMilliSeconds
459 Wait specified time interval to poll for DRQ bit clear in the Alternate Status Register.
461 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
462 @param[in] IdeIoRegisters A pointer to IDE IO registers.
463 @param[in] TimeoutInMilliSeconds Time specified in milliseconds.
465 @retval EFI_SUCCESS DRQ bit is cleared in the specified time interval.
466 @retval EFI_TIMEOUT DRQ bit is not cleared in the specified time interval.
471 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
472 IN IDE_BASE_REGISTERS
*IdeIoRegisters
,
473 IN UINTN TimeoutInMilliSeconds
477 Wait specified time interval to poll for DRQ bit set in the Status Register.
479 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
480 @param[in] IdeIoRegisters A pointer to IDE IO registers.
481 @param[in] TimeoutInMilliSeconds Time specified in milliseconds.
483 @retval EFI_SUCCESS DRQ bit is set in the specified time interval.
484 @retval EFI_TIMEOUT DRQ bit is not set in the specified time interval.
485 @retval EFI_ABORTED Operation Aborted.
490 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
491 IN IDE_BASE_REGISTERS
*IdeIoRegisters
,
492 IN UINTN TimeoutInMilliSeconds
496 Wait specified time interval to poll for DRQ bit set in the Alternate Status Register.
498 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
499 @param[in] IdeIoRegisters A pointer to IDE IO registers.
500 @param[in] TimeoutInMilliSeconds Time specified in milliseconds.
502 @retval EFI_SUCCESS DRQ bit is set in the specified time interval.
503 @retval EFI_TIMEOUT DRQ bit is not set in the specified time interval.
504 @retval EFI_ABORTED Operation Aborted.
509 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
510 IN IDE_BASE_REGISTERS
*IdeIoRegisters
,
511 IN UINTN TimeoutInMilliSeconds
515 Check if there is an error in Status Register.
517 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
518 @param[in] StatusReg The address to IDE IO registers.
520 @retval EFI_SUCCESS Operation success.
521 @retval EFI_DEVICE_ERROR Device error.
526 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
531 Idendify Atapi devices.
533 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
534 @param[in] DevicePosition An integer to signify device position.
536 @retval EFI_SUCCESS Identify successfully.
537 @retval EFI_DEVICE_ERROR Device cannot be identified successfully.
542 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
543 IN UINTN DevicePosition
547 Sends out ATAPI Test Unit Ready Packet Command to the specified device
548 to find out whether device is accessible.
550 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
551 @param[in] DevicePosition An integer to signify device position.
553 @retval EFI_SUCCESS TestUnit command executed successfully.
554 @retval EFI_DEVICE_ERROR Device cannot be executed TestUnit command successfully.
559 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
560 IN UINTN DevicePosition
564 Send out ATAPI commands conforms to the Packet Command with PIO Data In Protocol.
566 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
567 @param[in] DevicePosition An integer to signify device position.
568 @param[in] Packet A pointer to ATAPI command packet.
569 @param[in] Buffer Buffer to contain requested transfer data from device.
570 @param[in] ByteCount Requested transfer data length.
571 @param[in] TimeoutInMilliSeconds Time out value, in unit of milliseconds.
573 @retval EFI_SUCCESS Command executed successfully.
574 @retval EFI_DEVICE_ERROR Device cannot be executed command successfully.
578 AtapiPacketCommandIn (
579 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
580 IN UINTN DevicePosition
,
581 IN ATAPI_PACKET_COMMAND
*Packet
,
584 IN UINTN TimeoutInMilliSeconds
588 Sends out ATAPI Inquiry Packet Command to the specified device.
589 This command will return INQUIRY data of the device.
591 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
592 @param[in] DevicePosition An integer to signify device position.
593 @param[out] MediaInfo The media information of the specified block media.
594 @param[out] MediaInfo2 The media information 2 of the specified block media.
596 @retval EFI_SUCCESS Command executed successfully.
597 @retval EFI_DEVICE_ERROR Device cannot be executed command successfully.
598 @retval EFI_UNSUPPORTED Unsupported device type.
603 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
604 IN UINTN DevicePosition
,
605 OUT EFI_PEI_BLOCK_IO_MEDIA
*MediaInfo
,
606 OUT EFI_PEI_BLOCK_IO2_MEDIA
*MediaInfo2
610 Used before read/write blocks from/to ATAPI device media.
611 Since ATAPI device media is removable, it is necessary to detect
612 whether media is present and get current present media's information.
614 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
615 @param[in] DevicePosition An integer to signify device position.
616 @param[in, out] MediaInfo The media information of the specified block media.
617 @param[in, out] MediaInfo2 The media information 2 of the specified block media.
619 @retval EFI_SUCCESS Command executed successfully.
620 @retval EFI_DEVICE_ERROR Some device errors happen.
621 @retval EFI_OUT_OF_RESOURCES Can not allocate required resources.
626 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
627 IN UINTN DevicePosition
,
628 IN OUT EFI_PEI_BLOCK_IO_MEDIA
*MediaInfo
,
629 IN OUT EFI_PEI_BLOCK_IO2_MEDIA
*MediaInfo2
633 Reset specified Atapi device.
635 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
636 @param[in] DevicePosition An integer to signify device position.
637 @param[in] Extensive If TRUE, use ATA soft reset, otherwise use Atapi soft reset.
639 @retval EFI_SUCCESS Command executed successfully.
640 @retval EFI_DEVICE_ERROR Some device errors happen.
645 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
646 IN UINTN DevicePosition
,
651 Sends out ATAPI Request Sense Packet Command to the specified device.
653 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
654 @param[in] DevicePosition An integer to signify device position.
655 @param[in] SenseBuffers Pointer to sense buffer.
656 @param[in, out] SenseCounts Length of sense buffer.
658 @retval EFI_SUCCESS Command executed successfully.
659 @retval EFI_DEVICE_ERROR Some device errors happen.
664 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
665 IN UINTN DevicePosition
,
666 IN ATAPI_REQUEST_SENSE_DATA
*SenseBuffers
,
667 IN OUT UINT8
*SenseCounts
671 Sends out ATAPI Read Capacity Packet Command to the specified device.
672 This command will return the information regarding the capacity of the
675 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
676 @param[in] DevicePosition An integer to signify device position.
677 @param[in, out] MediaInfo The media information of the specified block media.
678 @param[in, out] MediaInfo2 The media information 2 of the specified block media.
680 @retval EFI_SUCCESS Command executed successfully.
681 @retval EFI_DEVICE_ERROR Some device errors happen.
686 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
687 IN UINTN DevicePosition
,
688 IN OUT EFI_PEI_BLOCK_IO_MEDIA
*MediaInfo
,
689 IN OUT EFI_PEI_BLOCK_IO2_MEDIA
*MediaInfo2
693 Perform read from disk in block unit.
695 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
696 @param[in] DevicePosition An integer to signify device position.
697 @param[in] Buffer Buffer to contain read data.
698 @param[in] StartLba Starting LBA address.
699 @param[in] NumberOfBlocks Number of blocks to read.
700 @param[in] BlockSize Size of each block.
702 @retval EFI_SUCCESS Command executed successfully.
703 @retval EFI_DEVICE_ERROR Some device errors happen.
708 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
709 IN UINTN DevicePosition
,
711 IN EFI_PEI_LBA StartLba
,
712 IN UINTN NumberOfBlocks
,
717 Check if there is media according to sense data.
719 @param[in] SenseData Pointer to sense data.
720 @param[in] SenseCounts Count of sense data.
722 @retval TRUE No media
723 @retval FALSE Media exists
728 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,
733 Check if device state is unclear according to sense data.
735 @param[in] SenseData Pointer to sense data.
736 @param[in] SenseCounts Count of sense data.
738 @retval TRUE Device state is unclear
739 @retval FALSE Device state is clear
743 IsDeviceStateUnclear (
744 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,
749 Check if there is media error according to sense data.
751 @param[in] SenseData Pointer to sense data.
752 @param[in] SenseCounts Count of sense data.
754 @retval TRUE Media error
755 @retval FALSE No media error
760 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,
765 Check if drive is ready according to sense data.
767 @param[in] SenseData Pointer to sense data.
768 @param[in] SenseCounts Count of sense data.
769 @param[out] NeedRetry Indicate if retry is needed.
771 @retval TRUE Drive ready
772 @retval FALSE Drive not ready
777 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,
778 IN UINTN SenseCounts
,
779 OUT BOOLEAN
*NeedRetry