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>
29 #include <IndustryStandard/Atapi.h>
31 #define MAX_SENSE_KEY_COUNT 6
32 #define MAX_IDE_CHANNELS 4 // Ide and Sata Primary, Secondary Channel.
33 #define MAX_IDE_DEVICES 8 // Ide, Sata Primary, Secondary and Master, Slave device.
51 UINT16 Command
; /* when write */
52 UINT16 Status
; /* when read */
56 UINT16 Error
; /* when read */
57 UINT16 Feature
; /* when write */
58 } IDE_ERROR_OR_FEATURE
;
61 UINT16 AltStatus
; /* when read */
62 UINT16 DeviceControl
; /* when write */
63 } IDE_ALTSTATUS_OR_DEVICECONTROL
;
70 IDE_ERROR_OR_FEATURE Reg1
;
76 IDE_CMD_OR_STATUS Reg
;
78 IDE_ALTSTATUS_OR_DEVICECONTROL Alt
;
84 EFI_PEI_BLOCK_IO_MEDIA MediaInfo
;
85 EFI_PEI_BLOCK_IO2_MEDIA MediaInfo2
;
86 } PEI_ATAPI_DEVICE_INFO
;
88 #define ATAPI_BLK_IO_DEV_SIGNATURE SIGNATURE_32 ('a', 'b', 'i', 'o')
92 EFI_PEI_RECOVERY_BLOCK_IO_PPI AtapiBlkIo
;
93 EFI_PEI_RECOVERY_BLOCK_IO2_PPI AtapiBlkIo2
;
94 EFI_PEI_PPI_DESCRIPTOR PpiDescriptor
;
95 EFI_PEI_PPI_DESCRIPTOR PpiDescriptor2
;
96 PEI_ATA_CONTROLLER_PPI
*AtaControllerPpi
;
99 PEI_ATAPI_DEVICE_INFO DeviceInfo
[MAX_IDE_DEVICES
]; // for max 8 device
100 IDE_BASE_REGISTERS IdeIoPortReg
[MAX_IDE_CHANNELS
]; // for max 4 channel.
103 #define PEI_RECOVERY_ATAPI_FROM_BLKIO_THIS(a) CR (a, ATAPI_BLK_IO_DEV, AtapiBlkIo, ATAPI_BLK_IO_DEV_SIGNATURE)
104 #define PEI_RECOVERY_ATAPI_FROM_BLKIO2_THIS(a) CR (a, ATAPI_BLK_IO_DEV, AtapiBlkIo2, ATAPI_BLK_IO_DEV_SIGNATURE)
106 #define STALL_1_MILLI_SECOND 1000 // stall 1 ms
107 #define STALL_1_SECONDS 1000 * STALL_1_MILLI_SECOND
110 // Time Out Value For IDE Device Polling
112 // ATATIMEOUT is used for waiting time out for ATA device
114 #define ATATIMEOUT 1000 // 1 second
115 // ATAPITIMEOUT is used for waiting operation
116 // except read and write time out for ATAPI device
118 #define ATAPITIMEOUT 1000 // 1 second
119 // ATAPILONGTIMEOUT is used for waiting read and
120 // write operation timeout for ATAPI device
122 #define CDROMLONGTIMEOUT 2000 // 2 seconds
123 #define ATAPILONGTIMEOUT 5000 // 5 seconds
126 // PEI Recovery Block I/O PPI
130 Gets the count of block I/O devices that one specific block driver detects.
132 This function is used for getting the count of block I/O devices that one
133 specific block driver detects. To the PEI ATAPI driver, it returns the number
134 of all the detected ATAPI devices it detects during the enumeration process.
135 To the PEI legacy floppy driver, it returns the number of all the legacy
136 devices it finds during its enumeration process. If no device is detected,
137 then the function will return zero.
139 @param[in] PeiServices General-purpose services that are available
141 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI
143 @param[out] NumberBlockDevices The number of block I/O devices discovered.
145 @retval EFI_SUCCESS Operation performed successfully.
150 AtapiGetNumberOfBlockDevices (
151 IN EFI_PEI_SERVICES
**PeiServices
,
152 IN EFI_PEI_RECOVERY_BLOCK_IO_PPI
*This
,
153 OUT UINTN
*NumberBlockDevices
157 Gets a block device's media information.
159 This function will provide the caller with the specified block device's media
160 information. If the media changes, calling this function will update the media
161 information accordingly.
163 @param[in] PeiServices General-purpose services that are available to every
165 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.
166 @param[in] DeviceIndex Specifies the block device to which the function wants
167 to talk. Because the driver that implements Block I/O
168 PPIs will manage multiple block devices, the PPIs that
169 want to talk to a single device must specify the
170 device index that was assigned during the enumeration
171 process. This index is a number from one to
173 @param[out] MediaInfo The media information of the specified block media.
174 The caller is responsible for the ownership of this
177 @retval EFI_SUCCESS Media information about the specified block device
178 was obtained successfully.
179 @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware
181 @retval Others Other failure occurs.
186 AtapiGetBlockDeviceMediaInfo (
187 IN EFI_PEI_SERVICES
**PeiServices
,
188 IN EFI_PEI_RECOVERY_BLOCK_IO_PPI
*This
,
189 IN UINTN DeviceIndex
,
190 OUT EFI_PEI_BLOCK_IO_MEDIA
*MediaInfo
194 Reads the requested number of blocks from the specified block device.
196 The function reads the requested number of blocks from the device. All the
197 blocks are read, or an error is returned. If there is no media in the device,
198 the function returns EFI_NO_MEDIA.
200 @param[in] PeiServices General-purpose services that are available to
202 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.
203 @param[in] DeviceIndex Specifies the block device to which the function wants
204 to talk. Because the driver that implements Block I/O
205 PPIs will manage multiple block devices, the PPIs that
206 want to talk to a single device must specify the device
207 index that was assigned during the enumeration process.
208 This index is a number from one to NumberBlockDevices.
209 @param[in] StartLBA The starting logical block address (LBA) to read from
211 @param[in] BufferSize The size of the Buffer in bytes. This number must be
212 a multiple of the intrinsic block size of the device.
213 @param[out] Buffer A pointer to the destination buffer for the data.
214 The caller is responsible for the ownership of the
217 @retval EFI_SUCCESS The data was read correctly from the device.
218 @retval EFI_DEVICE_ERROR The device reported an error while attempting
219 to perform the read operation.
220 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not
221 valid, or the buffer is not properly aligned.
222 @retval EFI_NO_MEDIA There is no media in the device.
223 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of
224 the intrinsic block size of the device.
230 IN EFI_PEI_SERVICES
**PeiServices
,
231 IN EFI_PEI_RECOVERY_BLOCK_IO_PPI
*This
,
232 IN UINTN DeviceIndex
,
233 IN EFI_PEI_LBA StartLBA
,
239 Gets the count of block I/O devices that one specific block driver detects.
241 This function is used for getting the count of block I/O devices that one
242 specific block driver detects. To the PEI ATAPI driver, it returns the number
243 of all the detected ATAPI devices it detects during the enumeration process.
244 To the PEI legacy floppy driver, it returns the number of all the legacy
245 devices it finds during its enumeration process. If no device is detected,
246 then the function will return zero.
248 @param[in] PeiServices General-purpose services that are available
250 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI
252 @param[out] NumberBlockDevices The number of block I/O devices discovered.
254 @retval EFI_SUCCESS Operation performed successfully.
259 AtapiGetNumberOfBlockDevices2 (
260 IN EFI_PEI_SERVICES
**PeiServices
,
261 IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI
*This
,
262 OUT UINTN
*NumberBlockDevices
266 Gets a block device's media information.
268 This function will provide the caller with the specified block device's media
269 information. If the media changes, calling this function will update the media
270 information accordingly.
272 @param[in] PeiServices General-purpose services that are available to every
274 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.
275 @param[in] DeviceIndex Specifies the block device to which the function wants
276 to talk. Because the driver that implements Block I/O
277 PPIs will manage multiple block devices, the PPIs that
278 want to talk to a single device must specify the
279 device index that was assigned during the enumeration
280 process. This index is a number from one to
282 @param[out] MediaInfo The media information of the specified block media.
283 The caller is responsible for the ownership of this
286 @retval EFI_SUCCESS Media information about the specified block device
287 was obtained successfully.
288 @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware
290 @retval Others Other failure occurs.
295 AtapiGetBlockDeviceMediaInfo2 (
296 IN EFI_PEI_SERVICES
**PeiServices
,
297 IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI
*This
,
298 IN UINTN DeviceIndex
,
299 OUT EFI_PEI_BLOCK_IO2_MEDIA
*MediaInfo
303 Reads the requested number of blocks from the specified block device.
305 The function reads the requested number of blocks from the device. All the
306 blocks are read, or an error is returned. If there is no media in the device,
307 the function returns EFI_NO_MEDIA.
309 @param[in] PeiServices General-purpose services that are available to
311 @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.
312 @param[in] DeviceIndex Specifies the block device to which the function wants
313 to talk. Because the driver that implements Block I/O
314 PPIs will manage multiple block devices, the PPIs that
315 want to talk to a single device must specify the device
316 index that was assigned during the enumeration process.
317 This index is a number from one to NumberBlockDevices.
318 @param[in] StartLBA The starting logical block address (LBA) to read from
320 @param[in] BufferSize The size of the Buffer in bytes. This number must be
321 a multiple of the intrinsic block size of the device.
322 @param[out] Buffer A pointer to the destination buffer for the data.
323 The caller is responsible for the ownership of the
326 @retval EFI_SUCCESS The data was read correctly from the device.
327 @retval EFI_DEVICE_ERROR The device reported an error while attempting
328 to perform the read operation.
329 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not
330 valid, or the buffer is not properly aligned.
331 @retval EFI_NO_MEDIA There is no media in the device.
332 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of
333 the intrinsic block size of the device.
339 IN EFI_PEI_SERVICES
**PeiServices
,
340 IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI
*This
,
341 IN UINTN DeviceIndex
,
342 IN EFI_PEI_LBA StartLBA
,
348 // Internal functions
352 Enumerate Atapi devices.
354 This function is used to enumerate Atatpi device in Ide channel.
356 @param[in] AtapiBlkIoDev A pointer to atapi block IO device
360 AtapiEnumerateDevices (
361 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
365 Detect Atapi devices.
367 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
368 @param[in] DevicePosition An integer to signify device position.
369 @param[out] MediaInfo The media information of the specified block media.
370 @param[out] MediaInfo2 The media information 2 of the specified block media.
372 @retval TRUE Atapi device exists in specified position.
373 @retval FALSE Atapi device does not exist in specified position.
377 DiscoverAtapiDevice (
378 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
379 IN UINTN DevicePosition
,
380 OUT EFI_PEI_BLOCK_IO_MEDIA
*MediaInfo
,
381 OUT EFI_PEI_BLOCK_IO2_MEDIA
*MediaInfo2
385 Detect if an IDE controller exists in specified position.
387 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
388 @param[in] DevicePosition An integer to signify device position.
390 @retval TRUE The Atapi device exists.
391 @retval FALSE The Atapi device does not present.
395 DetectIDEController (
396 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
397 IN UINTN DevicePosition
401 Wait specified time interval to poll for BSY bit clear in the Status Register.
403 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
404 @param[in] IdeIoRegisters A pointer to IDE IO registers.
405 @param[in] TimeoutInMilliSeconds Time specified in milliseconds.
407 @retval EFI_SUCCESS BSY bit is cleared in the specified time interval.
408 @retval EFI_TIMEOUT BSY bit is not cleared in the specified time interval.
413 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
414 IN IDE_BASE_REGISTERS
*IdeIoRegisters
,
415 IN UINTN TimeoutInMilliSeconds
419 Wait specified time interval to poll for DRDY bit set in the Status register.
421 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
422 @param[in] IdeIoRegisters A pointer to IDE IO registers.
423 @param[in] TimeoutInMilliSeconds Time specified in milliseconds.
425 @retval EFI_SUCCESS DRDY bit is set in the specified time interval.
426 @retval EFI_TIMEOUT DRDY bit is not set in the specified time interval.
431 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
432 IN IDE_BASE_REGISTERS
*IdeIoRegisters
,
433 IN UINTN TimeoutInMilliSeconds
437 Wait specified time interval to poll for DRQ bit clear in the Status Register.
439 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
440 @param[in] IdeIoRegisters A pointer to IDE IO registers.
441 @param[in] TimeoutInMilliSeconds Time specified in milliseconds.
443 @retval EFI_SUCCESS DRQ bit is cleared in the specified time interval.
444 @retval EFI_TIMEOUT DRQ bit is not cleared in the specified time interval.
449 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
450 IN IDE_BASE_REGISTERS
*IdeIoRegisters
,
451 IN UINTN TimeoutInMilliSeconds
455 Wait specified time interval to poll for DRQ bit clear in the Alternate Status Register.
457 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
458 @param[in] IdeIoRegisters A pointer to IDE IO registers.
459 @param[in] TimeoutInMilliSeconds Time specified in milliseconds.
461 @retval EFI_SUCCESS DRQ bit is cleared in the specified time interval.
462 @retval EFI_TIMEOUT DRQ bit is not cleared in the specified time interval.
467 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
468 IN IDE_BASE_REGISTERS
*IdeIoRegisters
,
469 IN UINTN TimeoutInMilliSeconds
473 Wait specified time interval to poll for DRQ bit set in the Status Register.
475 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
476 @param[in] IdeIoRegisters A pointer to IDE IO registers.
477 @param[in] TimeoutInMilliSeconds Time specified in milliseconds.
479 @retval EFI_SUCCESS DRQ bit is set in the specified time interval.
480 @retval EFI_TIMEOUT DRQ bit is not set in the specified time interval.
481 @retval EFI_ABORTED Operation Aborted.
486 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
487 IN IDE_BASE_REGISTERS
*IdeIoRegisters
,
488 IN UINTN TimeoutInMilliSeconds
492 Wait specified time interval to poll for DRQ bit set in the Alternate Status Register.
494 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
495 @param[in] IdeIoRegisters A pointer to IDE IO registers.
496 @param[in] TimeoutInMilliSeconds Time specified in milliseconds.
498 @retval EFI_SUCCESS DRQ bit is set in the specified time interval.
499 @retval EFI_TIMEOUT DRQ bit is not set in the specified time interval.
500 @retval EFI_ABORTED Operation Aborted.
505 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
506 IN IDE_BASE_REGISTERS
*IdeIoRegisters
,
507 IN UINTN TimeoutInMilliSeconds
511 Check if there is an error in Status Register.
513 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
514 @param[in] StatusReg The address to IDE IO registers.
516 @retval EFI_SUCCESS Operation success.
517 @retval EFI_DEVICE_ERROR Device error.
522 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
527 Idendify Atapi devices.
529 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
530 @param[in] DevicePosition An integer to signify device position.
532 @retval EFI_SUCCESS Identify successfully.
533 @retval EFI_DEVICE_ERROR Device cannot be identified successfully.
538 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
539 IN UINTN DevicePosition
543 Sends out ATAPI Test Unit Ready Packet Command to the specified device
544 to find out whether device is accessible.
546 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
547 @param[in] DevicePosition An integer to signify device position.
549 @retval EFI_SUCCESS TestUnit command executed successfully.
550 @retval EFI_DEVICE_ERROR Device cannot be executed TestUnit command successfully.
555 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
556 IN UINTN DevicePosition
560 Send out ATAPI commands conforms to the Packet Command with PIO Data In Protocol.
562 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
563 @param[in] DevicePosition An integer to signify device position.
564 @param[in] Packet A pointer to ATAPI command packet.
565 @param[in] Buffer Buffer to contain requested transfer data from device.
566 @param[in] ByteCount Requested transfer data length.
567 @param[in] TimeoutInMilliSeconds Time out value, in unit of milliseconds.
569 @retval EFI_SUCCESS Command executed successfully.
570 @retval EFI_DEVICE_ERROR Device cannot be executed command successfully.
574 AtapiPacketCommandIn (
575 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
576 IN UINTN DevicePosition
,
577 IN ATAPI_PACKET_COMMAND
*Packet
,
580 IN UINTN TimeoutInMilliSeconds
584 Sends out ATAPI Inquiry Packet Command to the specified device.
585 This command will return INQUIRY data of the device.
587 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
588 @param[in] DevicePosition An integer to signify device position.
589 @param[out] MediaInfo The media information of the specified block media.
590 @param[out] MediaInfo2 The media information 2 of the specified block media.
592 @retval EFI_SUCCESS Command executed successfully.
593 @retval EFI_DEVICE_ERROR Device cannot be executed command successfully.
594 @retval EFI_UNSUPPORTED Unsupported device type.
599 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
600 IN UINTN DevicePosition
,
601 OUT EFI_PEI_BLOCK_IO_MEDIA
*MediaInfo
,
602 OUT EFI_PEI_BLOCK_IO2_MEDIA
*MediaInfo2
606 Used before read/write blocks from/to ATAPI device media.
607 Since ATAPI device media is removable, it is necessary to detect
608 whether media is present and get current present media's information.
610 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
611 @param[in] DevicePosition An integer to signify device position.
612 @param[in, out] MediaInfo The media information of the specified block media.
613 @param[in, out] MediaInfo2 The media information 2 of the specified block media.
615 @retval EFI_SUCCESS Command executed successfully.
616 @retval EFI_DEVICE_ERROR Some device errors happen.
617 @retval EFI_OUT_OF_RESOURCES Can not allocate required resources.
622 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
623 IN UINTN DevicePosition
,
624 IN OUT EFI_PEI_BLOCK_IO_MEDIA
*MediaInfo
,
625 IN OUT EFI_PEI_BLOCK_IO2_MEDIA
*MediaInfo2
629 Reset specified Atapi device.
631 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
632 @param[in] DevicePosition An integer to signify device position.
633 @param[in] Extensive If TRUE, use ATA soft reset, otherwise use Atapi soft reset.
635 @retval EFI_SUCCESS Command executed successfully.
636 @retval EFI_DEVICE_ERROR Some device errors happen.
641 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
642 IN UINTN DevicePosition
,
647 Sends out ATAPI Request Sense Packet Command to the specified device.
649 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
650 @param[in] DevicePosition An integer to signify device position.
651 @param[in] SenseBuffers Pointer to sense buffer.
652 @param[in, out] SenseCounts Length of sense buffer.
654 @retval EFI_SUCCESS Command executed successfully.
655 @retval EFI_DEVICE_ERROR Some device errors happen.
660 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
661 IN UINTN DevicePosition
,
662 IN ATAPI_REQUEST_SENSE_DATA
*SenseBuffers
,
663 IN OUT UINT8
*SenseCounts
667 Sends out ATAPI Read Capacity Packet Command to the specified device.
668 This command will return the information regarding the capacity of the
671 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
672 @param[in] DevicePosition An integer to signify device position.
673 @param[in, out] MediaInfo The media information of the specified block media.
674 @param[in, out] MediaInfo2 The media information 2 of the specified block media.
676 @retval EFI_SUCCESS Command executed successfully.
677 @retval EFI_DEVICE_ERROR Some device errors happen.
682 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
683 IN UINTN DevicePosition
,
684 IN OUT EFI_PEI_BLOCK_IO_MEDIA
*MediaInfo
,
685 IN OUT EFI_PEI_BLOCK_IO2_MEDIA
*MediaInfo2
689 Perform read from disk in block unit.
691 @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
692 @param[in] DevicePosition An integer to signify device position.
693 @param[in] Buffer Buffer to contain read data.
694 @param[in] StartLba Starting LBA address.
695 @param[in] NumberOfBlocks Number of blocks to read.
696 @param[in] BlockSize Size of each block.
698 @retval EFI_SUCCESS Command executed successfully.
699 @retval EFI_DEVICE_ERROR Some device errors happen.
704 IN ATAPI_BLK_IO_DEV
*AtapiBlkIoDev
,
705 IN UINTN DevicePosition
,
707 IN EFI_PEI_LBA StartLba
,
708 IN UINTN NumberOfBlocks
,
713 Check if there is media according to sense data.
715 @param[in] SenseData Pointer to sense data.
716 @param[in] SenseCounts Count of sense data.
718 @retval TRUE No media
719 @retval FALSE Media exists
724 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,
729 Check if device state is unclear according to sense data.
731 @param[in] SenseData Pointer to sense data.
732 @param[in] SenseCounts Count of sense data.
734 @retval TRUE Device state is unclear
735 @retval FALSE Device state is clear
739 IsDeviceStateUnclear (
740 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,
745 Check if there is media error according to sense data.
747 @param[in] SenseData Pointer to sense data.
748 @param[in] SenseCounts Count of sense data.
750 @retval TRUE Media error
751 @retval FALSE No media error
756 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,
761 Check if drive is ready according to sense data.
763 @param[in] SenseData Pointer to sense data.
764 @param[in] SenseCounts Count of sense data.
765 @param[out] NeedRetry Indicate if retry is needed.
767 @retval TRUE Drive ready
768 @retval FALSE Drive not ready
773 IN ATAPI_REQUEST_SENSE_DATA
*SenseData
,
774 IN UINTN SenseCounts
,
775 OUT BOOLEAN
*NeedRetry