]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
Library class of MemoryAllocationLib has been added.
[mirror_edk2.git] / MdeModulePkg / Bus / Scsi / ScsiDiskDxe / ScsiDisk.h
1 /** @file
2 Header file for SCSI Disk Driver.
3
4 Copyright (c) 2004 - 2008, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _SCSI_DISK_H_
16 #define _SCSI_DISK_H_
17
18
19 #include <Uefi.h>
20
21
22 #include <Protocol/ScsiIo.h>
23 #include <Protocol/ComponentName.h>
24 #include <Protocol/BlockIo.h>
25 #include <Protocol/DriverBinding.h>
26 #include <Protocol/ScsiPassThruExt.h>
27
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
36 #include <IndustryStandard/Scsi.h>
37
38 #define IS_DEVICE_FIXED(a) (a)->FixedDevice ? 1 : 0
39
40 #define SCSI_DISK_DEV_SIGNATURE SIGNATURE_32 ('s', 'c', 'd', 'k')
41
42 typedef struct {
43 UINT32 Signature;
44
45 EFI_HANDLE Handle;
46
47 EFI_BLOCK_IO_PROTOCOL BlkIo;
48 EFI_BLOCK_IO_MEDIA BlkIoMedia;
49 EFI_SCSI_IO_PROTOCOL *ScsiIo;
50 UINT8 DeviceType;
51 BOOLEAN FixedDevice;
52 UINT16 Reserved;
53
54 EFI_SCSI_SENSE_DATA *SenseData;
55 UINTN SenseDataNumber;
56 EFI_SCSI_INQUIRY_DATA InquiryData;
57
58 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
59
60 } SCSI_DISK_DEV;
61
62 #define SCSI_DISK_DEV_FROM_THIS(a) CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)
63
64 //
65 // Global Variables
66 //
67 extern EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding;
68 extern EFI_COMPONENT_NAME_PROTOCOL gScsiDiskComponentName;
69 extern EFI_COMPONENT_NAME2_PROTOCOL gScsiDiskComponentName2;
70 //
71 // action code used in detect media process
72 //
73 #define ACTION_NO_ACTION 0x00
74 #define ACTION_READ_CAPACITY 0x01
75 #define ACTION_RETRY_COMMAND_LATER 0x02
76
77 /**
78 Test to see if this driver supports ControllerHandle.
79
80 This service is called by the EFI boot service ConnectController(). In order
81 to make drivers as small as possible, there are a few calling restrictions for
82 this service. ConnectController() must follow these calling restrictions.
83 If any other agent wishes to call Supported() it must also follow these
84 calling restrictions.
85
86 @param This Protocol instance pointer.
87 @param ControllerHandle Handle of device to test
88 @param RemainingDevicePath Optional parameter use to pick a specific child
89 device to start.
90
91 @retval EFI_SUCCESS This driver supports this device
92 @retval EFI_ALREADY_STARTED This driver is already running on this device
93 @retval other This driver does not support this device
94
95 **/
96 EFI_STATUS
97 EFIAPI
98 ScsiDiskDriverBindingSupported (
99 IN EFI_DRIVER_BINDING_PROTOCOL *This,
100 IN EFI_HANDLE Controller,
101 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
102 );
103
104 /**
105 Start this driver on ControllerHandle.
106
107 This service is called by the EFI boot service ConnectController(). In order
108 to make drivers as small as possible, there are a few calling restrictions for
109 this service. ConnectController() must follow these calling restrictions. If
110 any other agent wishes to call Start() it must also follow these calling
111 restrictions.
112
113 @param This Protocol instance pointer.
114 @param ControllerHandle Handle of device to bind driver to
115 @param RemainingDevicePath Optional parameter use to pick a specific child
116 device to start.
117
118 @retval EFI_SUCCESS This driver is added to ControllerHandle
119 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
120 @retval other This driver does not support this device
121
122 **/
123 EFI_STATUS
124 EFIAPI
125 ScsiDiskDriverBindingStart (
126 IN EFI_DRIVER_BINDING_PROTOCOL *This,
127 IN EFI_HANDLE Controller,
128 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
129 );
130
131 /**
132 Stop this driver on ControllerHandle.
133
134 This service is called by the EFI boot service DisconnectController().
135 In order to make drivers as small as possible, there are a few calling
136 restrictions for this service. DisconnectController() must follow these
137 calling restrictions. If any other agent wishes to call Stop() it must
138 also follow these calling restrictions.
139
140 @param This Protocol instance pointer.
141 @param ControllerHandle Handle of device to stop driver on
142 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
143 children is zero stop the entire bus driver.
144 @param ChildHandleBuffer List of Child Handles to Stop.
145
146 @retval EFI_SUCCESS This driver is removed ControllerHandle
147 @retval other This driver was not removed from this device
148
149 **/
150 EFI_STATUS
151 EFIAPI
152 ScsiDiskDriverBindingStop (
153 IN EFI_DRIVER_BINDING_PROTOCOL *This,
154 IN EFI_HANDLE Controller,
155 IN UINTN NumberOfChildren,
156 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
157 );
158
159 //
160 // EFI Component Name Functions
161 //
162 /**
163 Retrieves a Unicode string that is the user readable name of the driver.
164
165 This function retrieves the user readable name of a driver in the form of a
166 Unicode string. If the driver specified by This has a user readable name in
167 the language specified by Language, then a pointer to the driver name is
168 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
169 by This does not support the language specified by Language,
170 then EFI_UNSUPPORTED is returned.
171
172 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
173 EFI_COMPONENT_NAME_PROTOCOL instance.
174
175 @param Language A pointer to a Null-terminated ASCII string
176 array indicating the language. This is the
177 language of the driver name that the caller is
178 requesting, and it must match one of the
179 languages specified in SupportedLanguages. The
180 number of languages supported by a driver is up
181 to the driver writer. Language is specified
182 in RFC 3066 or ISO 639-2 language code format.
183
184 @param DriverName A pointer to the Unicode string to return.
185 This Unicode string is the name of the
186 driver specified by This in the language
187 specified by Language.
188
189 @retval EFI_SUCCESS The Unicode string for the Driver specified by
190 This and the language specified by Language was
191 returned in DriverName.
192
193 @retval EFI_INVALID_PARAMETER Language is NULL.
194
195 @retval EFI_INVALID_PARAMETER DriverName is NULL.
196
197 @retval EFI_UNSUPPORTED The driver specified by This does not support
198 the language specified by Language.
199
200 **/
201 EFI_STATUS
202 EFIAPI
203 ScsiDiskComponentNameGetDriverName (
204 IN EFI_COMPONENT_NAME_PROTOCOL *This,
205 IN CHAR8 *Language,
206 OUT CHAR16 **DriverName
207 );
208
209
210 /**
211 Retrieves a Unicode string that is the user readable name of the controller
212 that is being managed by a driver.
213
214 This function retrieves the user readable name of the controller specified by
215 ControllerHandle and ChildHandle in the form of a Unicode string. If the
216 driver specified by This has a user readable name in the language specified by
217 Language, then a pointer to the controller name is returned in ControllerName,
218 and EFI_SUCCESS is returned. If the driver specified by This is not currently
219 managing the controller specified by ControllerHandle and ChildHandle,
220 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
221 support the language specified by Language, then EFI_UNSUPPORTED is returned.
222
223 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
224 EFI_COMPONENT_NAME_PROTOCOL instance.
225
226 @param ControllerHandle The handle of a controller that the driver
227 specified by This is managing. This handle
228 specifies the controller whose name is to be
229 returned.
230
231 @param ChildHandle The handle of the child controller to retrieve
232 the name of. This is an optional parameter that
233 may be NULL. It will be NULL for device
234 drivers. It will also be NULL for a bus drivers
235 that wish to retrieve the name of the bus
236 controller. It will not be NULL for a bus
237 driver that wishes to retrieve the name of a
238 child controller.
239
240 @param Language A pointer to a Null-terminated ASCII string
241 array indicating the language. This is the
242 language of the driver name that the caller is
243 requesting, and it must match one of the
244 languages specified in SupportedLanguages. The
245 number of languages supported by a driver is up
246 to the driver writer. Language is specified in
247 RFC 3066 or ISO 639-2 language code format.
248
249 @param ControllerName A pointer to the Unicode string to return.
250 This Unicode string is the name of the
251 controller specified by ControllerHandle and
252 ChildHandle in the language specified by
253 Language from the point of view of the driver
254 specified by This.
255
256 @retval EFI_SUCCESS The Unicode string for the user readable name in
257 the language specified by Language for the
258 driver specified by This was returned in
259 DriverName.
260
261 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
262
263 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
264 EFI_HANDLE.
265
266 @retval EFI_INVALID_PARAMETER Language is NULL.
267
268 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
269
270 @retval EFI_UNSUPPORTED The driver specified by This is not currently
271 managing the controller specified by
272 ControllerHandle and ChildHandle.
273
274 @retval EFI_UNSUPPORTED The driver specified by This does not support
275 the language specified by Language.
276
277 **/
278 EFI_STATUS
279 EFIAPI
280 ScsiDiskComponentNameGetControllerName (
281 IN EFI_COMPONENT_NAME_PROTOCOL *This,
282 IN EFI_HANDLE ControllerHandle,
283 IN EFI_HANDLE ChildHandle OPTIONAL,
284 IN CHAR8 *Language,
285 OUT CHAR16 **ControllerName
286 );
287
288 /**
289 Reset SCSI Disk.
290
291
292 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
293 @param ExtendedVerification The flag about if extend verificate
294
295 @retval EFI_SUCCESS The device was reset.
296 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
297 not be reset.
298 @return EFI_STATUS is retured from EFI_SCSI_IO_PROTOCOL.ResetDevice().
299
300 **/
301 EFI_STATUS
302 EFIAPI
303 ScsiDiskReset (
304 IN EFI_BLOCK_IO_PROTOCOL *This,
305 IN BOOLEAN ExtendedVerification
306 );
307
308
309 /**
310 The function is to Read Block from SCSI Disk.
311
312 @param This The pointer of EFI_BLOCK_IO_PROTOCOL.
313 @param MediaId The Id of Media detected
314 @param Lba The logic block address
315 @param BufferSize The size of Buffer
316 @param Buffer The buffer to fill the read out data
317
318 @retval EFI_SUCCESS Successfully to read out block.
319 @retval EFI_DEVICE_ERROR Fail to detect media.
320 @retval EFI_NO_MEDIA Media is not present.
321 @retval EFI_MEDIA_CHANGED Media has changed.
322 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
323 @retval EFI_INVALID_PARAMETER Invalid parameter passed in.
324
325 **/
326 EFI_STATUS
327 EFIAPI
328 ScsiDiskReadBlocks (
329 IN EFI_BLOCK_IO_PROTOCOL *This,
330 IN UINT32 MediaId,
331 IN EFI_LBA Lba,
332 IN UINTN BufferSize,
333 OUT VOID *Buffer
334 );
335
336
337 /**
338 The function is to Write Block to SCSI Disk.
339
340 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
341 @param MediaId The Id of Media detected
342 @param Lba The logic block address
343 @param BufferSize The size of Buffer
344 @param Buffer The buffer to fill the read out data
345
346 @retval EFI_SUCCESS Successfully to read out block.
347 @retval EFI_WRITE_PROTECTED The device can not be written to.
348 @retval EFI_DEVICE_ERROR Fail to detect media.
349 @retval EFI_NO_MEDIA Media is not present.
350 @retval EFI_MEDIA_CHNAGED Media has changed.
351 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
352 @retval EFI_INVALID_PARAMETER Invalid parameter passed in.
353
354 **/
355 EFI_STATUS
356 EFIAPI
357 ScsiDiskWriteBlocks (
358 IN EFI_BLOCK_IO_PROTOCOL *This,
359 IN UINT32 MediaId,
360 IN EFI_LBA Lba,
361 IN UINTN BufferSize,
362 IN VOID *Buffer
363 );
364
365
366 /**
367 Flush Block to Disk.
368
369 EFI_SUCCESS is returned directly.
370
371 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
372
373 @retval EFI_SUCCESS All outstanding data was written to the device
374
375 **/
376 EFI_STATUS
377 EFIAPI
378 ScsiDiskFlushBlocks (
379 IN EFI_BLOCK_IO_PROTOCOL *This
380 );
381
382 /**
383 Dectect Device and read out capacity ,if error occurs, parse the sense key.
384
385 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
386 @param MustReadCapacity The flag about reading device capacity
387 @param MediaChange The pointer of flag indicates if media has changed
388
389 @retval EFI_DEVICE_ERROR Indicates that error occurs
390 @retval EFI_SUCCESS Successfully to detect media
391
392 **/
393 EFI_STATUS
394 ScsiDiskDetectMedia (
395 IN SCSI_DISK_DEV *ScsiDiskDevice,
396 IN BOOLEAN MustReadCapacity,
397 OUT BOOLEAN *MediaChange
398 );
399
400 /**
401 To test deivice.
402
403 When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;
404 When Test Unit Ready command encounters any error caused by host adapter or
405 target, return error without retrieving Sense Keys.
406
407 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
408 @param NeedRetry The pointer of flag indicates try again
409 @param SenseDataArray The pointer of an array of sense data
410 @param NumberOfSenseKeys The pointer of the number of sense data array
411
412 @retval EFI_DEVICE_ERROR Indicates that error occurs
413 @retval EFI_SUCCESS Successfully to test unit
414
415 **/
416 EFI_STATUS
417 ScsiDiskTestUnitReady (
418 IN SCSI_DISK_DEV *ScsiDiskDevice,
419 OUT BOOLEAN *NeedRetry,
420 OUT EFI_SCSI_SENSE_DATA **SenseDataArray,
421 OUT UINTN *NumberOfSenseKeys
422 );
423
424
425 /**
426 Parsing Sense Keys which got from request sense command.
427
428 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
429 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
430 @param NumberOfSenseKeys The number of sense key
431 @param Action The pointer of action which indicates what is need to do next
432
433 @retval EFI_DEVICE_ERROR Indicates that error occurs
434 @retval EFI_SUCCESS Successfully to complete the parsing
435
436 **/
437 EFI_STATUS
438 DetectMediaParsingSenseKeys (
439 OUT SCSI_DISK_DEV *ScsiDiskDevice,
440 IN EFI_SCSI_SENSE_DATA *SenseData,
441 IN UINTN NumberOfSenseKeys,
442 OUT UINTN *Action
443 );
444
445
446 /**
447 Send read capacity command to device and get the device parameter.
448
449 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
450 @param NeedRetry The pointer of flag indicates if need a retry
451 @param SenseDataArray The pointer of an array of sense data
452 @param NumberOfSenseKeys The number of sense key
453
454 @retval EFI_DEVICE_ERROR Indicates that error occurs
455 @retval EFI_SUCCESS Successfully to read capacity
456
457 **/
458 EFI_STATUS
459 ScsiDiskReadCapacity (
460 IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
461 OUT BOOLEAN *NeedRetry,
462 OUT EFI_SCSI_SENSE_DATA **SenseDataArray,
463 OUT UINTN *NumberOfSenseKeys
464 );
465
466 /**
467 Check the HostAdapter status and re-interpret it in EFI_STATUS.
468
469 @param HostAdapterStatus Host Adapter status
470
471 @retval EFI_SUCCESS Host adapter is OK.
472 @retval EFI_TIMEOUT Timeout.
473 @retval EFI_NOT_READY Adapter NOT ready.
474 @retval EFI_DEVICE_ERROR Adapter device error.
475
476 **/
477 EFI_STATUS
478 CheckHostAdapterStatus (
479 IN UINT8 HostAdapterStatus
480 );
481
482
483 /**
484 Check the target status and re-interpret it in EFI_STATUS.
485
486 @param TargetStatus Target status
487
488 @retval EFI_NOT_READY Device is NOT ready.
489 @retval EFI_DEVICE_ERROR
490 @retval EFI_SUCCESS
491
492 **/
493 EFI_STATUS
494 CheckTargetStatus (
495 IN UINT8 TargetStatus
496 );
497
498 /**
499 Retrieve all sense keys from the device.
500
501 When encountering error during the process, if retrieve sense keys before
502 error encounterred, it returns the sense keys with return status set to EFI_SUCCESS,
503 and NeedRetry set to FALSE; otherwize, return the proper return status.
504
505 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
506 @param NeedRetry The pointer of flag indicates if need a retry
507 @param SenseDataArray The pointer of an array of sense data
508 @param NumberOfSenseKeys The number of sense key
509 @param AskResetIfError The flag indicates if need reset when error occurs
510
511 @retval EFI_DEVICE_ERROR Indicates that error occurs
512 @retval EFI_SUCCESS Successfully to request sense key
513
514 **/
515 EFI_STATUS
516 ScsiDiskRequestSenseKeys (
517 IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
518 OUT BOOLEAN *NeedRetry,
519 OUT EFI_SCSI_SENSE_DATA **SenseDataArray,
520 OUT UINTN *NumberOfSenseKeys,
521 IN BOOLEAN AskResetIfError
522 );
523
524 /**
525 Send out Inquiry command to Device.
526
527 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
528 @param NeedRetry Indicates if needs try again when error happens
529
530 @retval EFI_DEVICE_ERROR Indicates that error occurs
531 @retval EFI_SUCCESS Successfully to detect media
532
533 **/
534 EFI_STATUS
535 ScsiDiskInquiryDevice (
536 IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
537 OUT BOOLEAN *NeedRetry
538 );
539
540 /**
541 Parse Inquiry data.
542
543 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
544
545 **/
546 VOID
547 ParseInquiryData (
548 IN OUT SCSI_DISK_DEV *ScsiDiskDevice
549 );
550
551 /**
552 Read sector from SCSI Disk.
553
554 @param ScsiDiskDevice The poiniter of SCSI_DISK_DEV
555 @param Buffer The buffer to fill in the read out data
556 @param Lba Logic block address
557 @param NumberOfBlocks The number of blocks to read
558
559 @retval EFI_DEVICE_ERROR Indicates a device error.
560 @retval EFI_SUCCESS Operation is successful.
561
562 **/
563 EFI_STATUS
564 ScsiDiskReadSectors (
565 IN SCSI_DISK_DEV *ScsiDiskDevice,
566 OUT VOID *Buffer,
567 IN EFI_LBA Lba,
568 IN UINTN NumberOfBlocks
569 );
570
571 /**
572 Write sector to SCSI Disk.
573
574 @param ScsiDiskDevice The poiniter of SCSI_DISK_DEV
575 @param Buffer The buffer of data to be written into SCSI Disk
576 @param Lba Logic block address
577 @param NumberOfBlocks The number of blocks to read
578
579 @retval EFI_DEVICE_ERROR Indicates a device error.
580 @retval EFI_SUCCESS Operation is successful.
581
582 **/
583 EFI_STATUS
584 ScsiDiskWriteSectors (
585 IN SCSI_DISK_DEV *ScsiDiskDevice,
586 IN VOID *Buffer,
587 IN EFI_LBA Lba,
588 IN UINTN NumberOfBlocks
589 );
590
591 /**
592 Sumbmit Read command.
593
594 @param ScsiDiskDevice The pointer of ScsiDiskDevice
595 @param NeedRetry The pointer of flag indicates if needs retry if error happens
596 @param SenseDataArray NOT used yet in this function
597 @param NumberOfSenseKeys The number of sense key
598 @param Timeout The time to complete the command
599 @param DataBuffer The buffer to fill with the read out data
600 @param DataLength The length of buffer
601 @param StartLba The start logic block address
602 @param SectorSize The size of sector
603
604 @return EFI_STATUS is returned by calling ScsiRead10Command().
605 **/
606 EFI_STATUS
607 ScsiDiskRead10 (
608 IN SCSI_DISK_DEV *ScsiDiskDevice,
609 OUT BOOLEAN *NeedRetry,
610 OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL
611 OUT UINTN *NumberOfSenseKeys,
612 IN UINT64 Timeout,
613 OUT UINT8 *DataBuffer,
614 IN OUT UINT32 *DataLength,
615 IN UINT32 StartLba,
616 IN UINT32 SectorSize
617 );
618
619 /**
620 Submit Write Command.
621
622 @param ScsiDiskDevice The pointer of ScsiDiskDevice
623 @param NeedRetry The pointer of flag indicates if needs retry if error happens
624 @param SenseDataArray NOT used yet in this function
625 @param NumberOfSenseKeys The number of sense key
626 @param Timeout The time to complete the command
627 @param DataBuffer The buffer to fill with the read out data
628 @param DataLength The length of buffer
629 @param StartLba The start logic block address
630 @param SectorSize The size of sector
631
632 @return EFI_STATUS is returned by calling ScsiWrite10Command().
633
634 **/
635 EFI_STATUS
636 ScsiDiskWrite10 (
637 IN SCSI_DISK_DEV *ScsiDiskDevice,
638 OUT BOOLEAN *NeedRetry,
639 OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL
640 OUT UINTN *NumberOfSenseKeys,
641 IN UINT64 Timeout,
642 IN UINT8 *DataBuffer,
643 IN OUT UINT32 *DataLength,
644 IN UINT32 StartLba,
645 IN UINT32 SectorSize
646 );
647
648 /**
649 Get information from media read capacity command.
650
651 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
652 @param Capacity The pointer of EFI_SCSI_DISK_CAPACITY_DATA
653
654 **/
655 VOID
656 GetMediaInfo (
657 IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
658 IN EFI_SCSI_DISK_CAPACITY_DATA *Capacity
659 );
660
661 /**
662 Check sense key to find if media presents.
663
664 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
665 @param SenseCounts The number of sense key
666
667 @retval TRUE NOT any media
668 @retval FALSE Media presents
669 **/
670 BOOLEAN
671 ScsiDiskIsNoMedia (
672 IN EFI_SCSI_SENSE_DATA *SenseData,
673 IN UINTN SenseCounts
674 );
675
676 /**
677 Parse sense key.
678
679 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
680 @param SenseCounts The number of sense key
681
682 @retval TRUE Error
683 @retval FALSE NOT error
684
685 **/
686 BOOLEAN
687 ScsiDiskIsMediaError (
688 IN EFI_SCSI_SENSE_DATA *SenseData,
689 IN UINTN SenseCounts
690 );
691
692 /**
693 Check sense key to find if hardware error happens.
694
695 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
696 @param SenseCounts The number of sense key
697
698 @retval TRUE Hardware error exits.
699 @retval FALSE NO error.
700
701 **/
702 BOOLEAN
703 ScsiDiskIsHardwareError (
704 IN EFI_SCSI_SENSE_DATA *SenseData,
705 IN UINTN SenseCounts
706 );
707
708 /**
709 Check sense key to find if media has changed.
710
711 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
712 @param SenseCounts The number of sense key
713
714 @retval TRUE Media is changed.
715 @retval FALSE Medit is NOT changed.
716 **/
717 BOOLEAN
718 ScsiDiskIsMediaChange (
719 IN EFI_SCSI_SENSE_DATA *SenseData,
720 IN UINTN SenseCounts
721 );
722
723 /**
724 Check sense key to find if reset happens.
725
726 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
727 @param SenseCounts The number of sense key
728
729 @retval TRUE It is reset before.
730 @retval FALSE It is NOT reset before.
731
732 **/
733 BOOLEAN
734 ScsiDiskIsResetBefore (
735 IN EFI_SCSI_SENSE_DATA *SenseData,
736 IN UINTN SenseCounts
737 );
738
739 /**
740 Check sense key to find if the drive is ready.
741
742 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
743 @param SenseCounts The number of sense key
744 @param RetryLater The flag means if need a retry
745
746 @retval TRUE Drive is ready.
747 @retval FALSE Drive is NOT ready.
748
749 **/
750 BOOLEAN
751 ScsiDiskIsDriveReady (
752 IN EFI_SCSI_SENSE_DATA *SenseData,
753 IN UINTN SenseCounts,
754 OUT BOOLEAN *RetryLater
755 );
756
757 /**
758 Check sense key to find if it has sense key.
759
760 @param SenseData - The pointer of EFI_SCSI_SENSE_DATA
761 @param SenseCounts - The number of sense key
762
763 @retval TRUE It has sense key.
764 @retval FALSE It has NOT any sense key.
765
766 **/
767 BOOLEAN
768 ScsiDiskHaveSenseKey (
769 IN EFI_SCSI_SENSE_DATA *SenseData,
770 IN UINTN SenseCounts
771 );
772
773 /**
774 Release resource about disk device.
775
776 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
777
778 **/
779 VOID
780 ReleaseScsiDiskDeviceResources (
781 IN SCSI_DISK_DEV *ScsiDiskDevice
782 );
783
784 #endif