]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Scsi / ScsiDiskDxe / ScsiDisk.h
1 /** @file
2 Header file for SCSI Disk Driver.
3
4 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef _SCSI_DISK_H_
10 #define _SCSI_DISK_H_
11
12
13 #include <Uefi.h>
14
15
16 #include <Protocol/ScsiIo.h>
17 #include <Protocol/ComponentName.h>
18 #include <Protocol/BlockIo.h>
19 #include <Protocol/BlockIo2.h>
20 #include <Protocol/EraseBlock.h>
21 #include <Protocol/DriverBinding.h>
22 #include <Protocol/ScsiPassThruExt.h>
23 #include <Protocol/ScsiPassThru.h>
24 #include <Protocol/DiskInfo.h>
25
26
27 #include <Library/DebugLib.h>
28 #include <Library/UefiDriverEntryPoint.h>
29 #include <Library/UefiLib.h>
30 #include <Library/BaseMemoryLib.h>
31 #include <Library/MemoryAllocationLib.h>
32 #include <Library/UefiScsiLib.h>
33 #include <Library/UefiBootServicesTableLib.h>
34 #include <Library/DevicePathLib.h>
35
36 #include <IndustryStandard/Scsi.h>
37 #include <IndustryStandard/Atapi.h>
38
39 #define IS_DEVICE_FIXED(a) (a)->FixedDevice ? 1 : 0
40
41 typedef struct {
42 UINT32 MaxLbaCnt;
43 UINT32 MaxBlkDespCnt;
44 UINT32 GranularityAlignment;
45 } SCSI_UNMAP_PARAM_INFO;
46
47 #define SCSI_DISK_DEV_SIGNATURE SIGNATURE_32 ('s', 'c', 'd', 'k')
48
49 typedef struct {
50 UINT32 Signature;
51
52 EFI_HANDLE Handle;
53
54 EFI_BLOCK_IO_PROTOCOL BlkIo;
55 EFI_BLOCK_IO2_PROTOCOL BlkIo2;
56 EFI_BLOCK_IO_MEDIA BlkIoMedia;
57 EFI_ERASE_BLOCK_PROTOCOL EraseBlock;
58 EFI_SCSI_IO_PROTOCOL *ScsiIo;
59 UINT8 DeviceType;
60 BOOLEAN FixedDevice;
61 UINT16 Reserved;
62
63 EFI_SCSI_SENSE_DATA *SenseData;
64 UINTN SenseDataNumber;
65 EFI_SCSI_INQUIRY_DATA InquiryData;
66
67 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
68
69 EFI_DISK_INFO_PROTOCOL DiskInfo;
70
71 //
72 // The following fields are only valid for ATAPI/SATA device
73 //
74 UINT32 Channel;
75 UINT32 Device;
76 ATAPI_IDENTIFY_DATA IdentifyData;
77
78 //
79 // Scsi UNMAP command parameters information
80 //
81 SCSI_UNMAP_PARAM_INFO UnmapInfo;
82 BOOLEAN BlockLimitsVpdSupported;
83
84 //
85 // The flag indicates if 16-byte command can be used
86 //
87 BOOLEAN Cdb16Byte;
88
89 //
90 // The queue for asynchronous task requests
91 //
92 LIST_ENTRY AsyncTaskQueue;
93 } SCSI_DISK_DEV;
94
95 #define SCSI_DISK_DEV_FROM_BLKIO(a) CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)
96 #define SCSI_DISK_DEV_FROM_BLKIO2(a) CR (a, SCSI_DISK_DEV, BlkIo2, SCSI_DISK_DEV_SIGNATURE)
97 #define SCSI_DISK_DEV_FROM_ERASEBLK(a) CR (a, SCSI_DISK_DEV, EraseBlock, SCSI_DISK_DEV_SIGNATURE)
98
99 #define SCSI_DISK_DEV_FROM_DISKINFO(a) CR (a, SCSI_DISK_DEV, DiskInfo, SCSI_DISK_DEV_SIGNATURE)
100
101 //
102 // Asynchronous I/O request
103 //
104 //
105 // Private data structure for a BlockIo2 request
106 //
107 typedef struct {
108 EFI_BLOCK_IO2_TOKEN *Token;
109 //
110 // The flag indicates if the last Scsi Read/Write sub-task for a BlockIo2
111 // request is sent to device
112 //
113 BOOLEAN LastScsiRW;
114
115 //
116 // The queue for Scsi Read/Write sub-tasks of a BlockIo2 request
117 //
118 LIST_ENTRY ScsiRWQueue;
119
120 LIST_ENTRY Link;
121 } SCSI_BLKIO2_REQUEST;
122
123 //
124 // Private data structure for a SCSI Read/Write request
125 //
126 typedef struct {
127 SCSI_DISK_DEV *ScsiDiskDevice;
128 UINT64 Timeout;
129 EFI_SCSI_SENSE_DATA *SenseData;
130 UINT8 SenseDataLength;
131 UINT8 HostAdapterStatus;
132 UINT8 TargetStatus;
133 UINT8 *InBuffer;
134 UINT8 *OutBuffer;
135 UINT32 DataLength;
136 UINT64 StartLba;
137 UINT32 SectorCount;
138 UINT8 TimesRetry;
139
140 //
141 // The BlockIo2 request this SCSI command belongs to
142 //
143 SCSI_BLKIO2_REQUEST *BlkIo2Req;
144
145 LIST_ENTRY Link;
146 } SCSI_ASYNC_RW_REQUEST;
147
148 //
149 // Private data structure for an EraseBlock request
150 //
151 typedef struct {
152 EFI_ERASE_BLOCK_TOKEN *Token;
153
154 EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
155
156 LIST_ENTRY Link;
157 } SCSI_ERASEBLK_REQUEST;
158
159 //
160 // Global Variables
161 //
162 extern EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding;
163 extern EFI_COMPONENT_NAME_PROTOCOL gScsiDiskComponentName;
164 extern EFI_COMPONENT_NAME2_PROTOCOL gScsiDiskComponentName2;
165 //
166 // action code used in detect media process
167 //
168 #define ACTION_NO_ACTION 0x00
169 #define ACTION_READ_CAPACITY 0x01
170 #define ACTION_RETRY_COMMAND_LATER 0x02
171 #define ACTION_RETRY_WITH_BACKOFF_ALGO 0x03
172
173 #define SCSI_COMMAND_VERSION_1 0x01
174 #define SCSI_COMMAND_VERSION_2 0x02
175 #define SCSI_COMMAND_VERSION_3 0x03
176
177 //
178 // SCSI Disk Timeout Experience Value
179 //
180 // As ScsiDisk and ScsiBus driver are used to manage SCSI or ATAPI devices, the timout
181 // value is updated to 30s to follow ATA/ATAPI spec in which the device may take up to 30s
182 // to respond command.
183 //
184 #define SCSI_DISK_TIMEOUT EFI_TIMER_PERIOD_SECONDS (30)
185
186 /**
187 Test to see if this driver supports ControllerHandle.
188
189 This service is called by the EFI boot service ConnectController(). In order
190 to make drivers as small as possible, there are a few calling restrictions for
191 this service. ConnectController() must follow these calling restrictions.
192 If any other agent wishes to call Supported() it must also follow these
193 calling restrictions.
194
195 @param This Protocol instance pointer.
196 @param ControllerHandle Handle of device to test
197 @param RemainingDevicePath Optional parameter use to pick a specific child
198 device to start.
199
200 @retval EFI_SUCCESS This driver supports this device
201 @retval EFI_ALREADY_STARTED This driver is already running on this device
202 @retval other This driver does not support this device
203
204 **/
205 EFI_STATUS
206 EFIAPI
207 ScsiDiskDriverBindingSupported (
208 IN EFI_DRIVER_BINDING_PROTOCOL *This,
209 IN EFI_HANDLE Controller,
210 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
211 );
212
213 /**
214 Start this driver on ControllerHandle.
215
216 This service is called by the EFI boot service ConnectController(). In order
217 to make drivers as small as possible, there are a few calling restrictions for
218 this service. ConnectController() must follow these calling restrictions. If
219 any other agent wishes to call Start() it must also follow these calling
220 restrictions.
221
222 @param This Protocol instance pointer.
223 @param ControllerHandle Handle of device to bind driver to
224 @param RemainingDevicePath Optional parameter use to pick a specific child
225 device to start.
226
227 @retval EFI_SUCCESS This driver is added to ControllerHandle
228 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
229 @retval other This driver does not support this device
230
231 **/
232 EFI_STATUS
233 EFIAPI
234 ScsiDiskDriverBindingStart (
235 IN EFI_DRIVER_BINDING_PROTOCOL *This,
236 IN EFI_HANDLE Controller,
237 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
238 );
239
240 /**
241 Stop this driver on ControllerHandle.
242
243 This service is called by the EFI boot service DisconnectController().
244 In order to make drivers as small as possible, there are a few calling
245 restrictions for this service. DisconnectController() must follow these
246 calling restrictions. If any other agent wishes to call Stop() it must
247 also follow these calling restrictions.
248
249 @param This Protocol instance pointer.
250 @param ControllerHandle Handle of device to stop driver on
251 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
252 children is zero stop the entire bus driver.
253 @param ChildHandleBuffer List of Child Handles to Stop.
254
255 @retval EFI_SUCCESS This driver is removed ControllerHandle
256 @retval other This driver was not removed from this device
257
258 **/
259 EFI_STATUS
260 EFIAPI
261 ScsiDiskDriverBindingStop (
262 IN EFI_DRIVER_BINDING_PROTOCOL *This,
263 IN EFI_HANDLE Controller,
264 IN UINTN NumberOfChildren,
265 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
266 );
267
268 //
269 // EFI Component Name Functions
270 //
271 /**
272 Retrieves a Unicode string that is the user readable name of the driver.
273
274 This function retrieves the user readable name of a driver in the form of a
275 Unicode string. If the driver specified by This has a user readable name in
276 the language specified by Language, then a pointer to the driver name is
277 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
278 by This does not support the language specified by Language,
279 then EFI_UNSUPPORTED is returned.
280
281 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
282 EFI_COMPONENT_NAME_PROTOCOL instance.
283
284 @param Language A pointer to a Null-terminated ASCII string
285 array indicating the language. This is the
286 language of the driver name that the caller is
287 requesting, and it must match one of the
288 languages specified in SupportedLanguages. The
289 number of languages supported by a driver is up
290 to the driver writer. Language is specified
291 in RFC 4646 or ISO 639-2 language code format.
292
293 @param DriverName A pointer to the Unicode string to return.
294 This Unicode string is the name of the
295 driver specified by This in the language
296 specified by Language.
297
298 @retval EFI_SUCCESS The Unicode string for the Driver specified by
299 This and the language specified by Language was
300 returned in DriverName.
301
302 @retval EFI_INVALID_PARAMETER Language is NULL.
303
304 @retval EFI_INVALID_PARAMETER DriverName is NULL.
305
306 @retval EFI_UNSUPPORTED The driver specified by This does not support
307 the language specified by Language.
308
309 **/
310 EFI_STATUS
311 EFIAPI
312 ScsiDiskComponentNameGetDriverName (
313 IN EFI_COMPONENT_NAME_PROTOCOL *This,
314 IN CHAR8 *Language,
315 OUT CHAR16 **DriverName
316 );
317
318
319 /**
320 Retrieves a Unicode string that is the user readable name of the controller
321 that is being managed by a driver.
322
323 This function retrieves the user readable name of the controller specified by
324 ControllerHandle and ChildHandle in the form of a Unicode string. If the
325 driver specified by This has a user readable name in the language specified by
326 Language, then a pointer to the controller name is returned in ControllerName,
327 and EFI_SUCCESS is returned. If the driver specified by This is not currently
328 managing the controller specified by ControllerHandle and ChildHandle,
329 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
330 support the language specified by Language, then EFI_UNSUPPORTED is returned.
331
332 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
333 EFI_COMPONENT_NAME_PROTOCOL instance.
334
335 @param ControllerHandle The handle of a controller that the driver
336 specified by This is managing. This handle
337 specifies the controller whose name is to be
338 returned.
339
340 @param ChildHandle The handle of the child controller to retrieve
341 the name of. This is an optional parameter that
342 may be NULL. It will be NULL for device
343 drivers. It will also be NULL for a bus drivers
344 that wish to retrieve the name of the bus
345 controller. It will not be NULL for a bus
346 driver that wishes to retrieve the name of a
347 child controller.
348
349 @param Language A pointer to a Null-terminated ASCII string
350 array indicating the language. This is the
351 language of the driver name that the caller is
352 requesting, and it must match one of the
353 languages specified in SupportedLanguages. The
354 number of languages supported by a driver is up
355 to the driver writer. Language is specified in
356 RFC 4646 or ISO 639-2 language code format.
357
358 @param ControllerName A pointer to the Unicode string to return.
359 This Unicode string is the name of the
360 controller specified by ControllerHandle and
361 ChildHandle in the language specified by
362 Language from the point of view of the driver
363 specified by This.
364
365 @retval EFI_SUCCESS The Unicode string for the user readable name in
366 the language specified by Language for the
367 driver specified by This was returned in
368 DriverName.
369
370 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
371
372 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
373 EFI_HANDLE.
374
375 @retval EFI_INVALID_PARAMETER Language is NULL.
376
377 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
378
379 @retval EFI_UNSUPPORTED The driver specified by This is not currently
380 managing the controller specified by
381 ControllerHandle and ChildHandle.
382
383 @retval EFI_UNSUPPORTED The driver specified by This does not support
384 the language specified by Language.
385
386 **/
387 EFI_STATUS
388 EFIAPI
389 ScsiDiskComponentNameGetControllerName (
390 IN EFI_COMPONENT_NAME_PROTOCOL *This,
391 IN EFI_HANDLE ControllerHandle,
392 IN EFI_HANDLE ChildHandle OPTIONAL,
393 IN CHAR8 *Language,
394 OUT CHAR16 **ControllerName
395 );
396
397 /**
398 Reset SCSI Disk.
399
400
401 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
402 @param ExtendedVerification The flag about if extend verificate
403
404 @retval EFI_SUCCESS The device was reset.
405 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
406 not be reset.
407 @return EFI_STATUS is retured from EFI_SCSI_IO_PROTOCOL.ResetDevice().
408
409 **/
410 EFI_STATUS
411 EFIAPI
412 ScsiDiskReset (
413 IN EFI_BLOCK_IO_PROTOCOL *This,
414 IN BOOLEAN ExtendedVerification
415 );
416
417
418 /**
419 The function is to Read Block from SCSI Disk.
420
421 @param This The pointer of EFI_BLOCK_IO_PROTOCOL.
422 @param MediaId The Id of Media detected
423 @param Lba The logic block address
424 @param BufferSize The size of Buffer
425 @param Buffer The buffer to fill the read out data
426
427 @retval EFI_SUCCESS Successfully to read out block.
428 @retval EFI_DEVICE_ERROR Fail to detect media.
429 @retval EFI_NO_MEDIA Media is not present.
430 @retval EFI_MEDIA_CHANGED Media has changed.
431 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
432 @retval EFI_INVALID_PARAMETER Invalid parameter passed in.
433
434 **/
435 EFI_STATUS
436 EFIAPI
437 ScsiDiskReadBlocks (
438 IN EFI_BLOCK_IO_PROTOCOL *This,
439 IN UINT32 MediaId,
440 IN EFI_LBA Lba,
441 IN UINTN BufferSize,
442 OUT VOID *Buffer
443 );
444
445
446 /**
447 The function is to Write Block to SCSI Disk.
448
449 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
450 @param MediaId The Id of Media detected
451 @param Lba The logic block address
452 @param BufferSize The size of Buffer
453 @param Buffer The buffer to fill the read out data
454
455 @retval EFI_SUCCESS Successfully to read out block.
456 @retval EFI_WRITE_PROTECTED The device can not be written to.
457 @retval EFI_DEVICE_ERROR Fail to detect media.
458 @retval EFI_NO_MEDIA Media is not present.
459 @retval EFI_MEDIA_CHNAGED Media has changed.
460 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
461 @retval EFI_INVALID_PARAMETER Invalid parameter passed in.
462
463 **/
464 EFI_STATUS
465 EFIAPI
466 ScsiDiskWriteBlocks (
467 IN EFI_BLOCK_IO_PROTOCOL *This,
468 IN UINT32 MediaId,
469 IN EFI_LBA Lba,
470 IN UINTN BufferSize,
471 IN VOID *Buffer
472 );
473
474
475 /**
476 Flush Block to Disk.
477
478 EFI_SUCCESS is returned directly.
479
480 @param This The pointer of EFI_BLOCK_IO_PROTOCOL
481
482 @retval EFI_SUCCESS All outstanding data was written to the device
483
484 **/
485 EFI_STATUS
486 EFIAPI
487 ScsiDiskFlushBlocks (
488 IN EFI_BLOCK_IO_PROTOCOL *This
489 );
490
491
492 /**
493 Reset SCSI Disk.
494
495 @param This The pointer of EFI_BLOCK_IO2_PROTOCOL.
496 @param ExtendedVerification The flag about if extend verificate.
497
498 @retval EFI_SUCCESS The device was reset.
499 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
500 not be reset.
501 @return EFI_STATUS is returned from EFI_SCSI_IO_PROTOCOL.ResetDevice().
502
503 **/
504 EFI_STATUS
505 EFIAPI
506 ScsiDiskResetEx (
507 IN EFI_BLOCK_IO2_PROTOCOL *This,
508 IN BOOLEAN ExtendedVerification
509 );
510
511 /**
512 The function is to Read Block from SCSI Disk.
513
514 @param This The pointer of EFI_BLOCK_IO_PROTOCOL.
515 @param MediaId The Id of Media detected.
516 @param Lba The logic block address.
517 @param Token A pointer to the token associated with the transaction.
518 @param BufferSize The size of Buffer.
519 @param Buffer The buffer to fill the read out data.
520
521 @retval EFI_SUCCESS The read request was queued if Token-> Event is
522 not NULL. The data was read correctly from the
523 device if theToken-> Event is NULL.
524 @retval EFI_DEVICE_ERROR The device reported an error while attempting
525 to perform the read operation.
526 @retval EFI_NO_MEDIA There is no media in the device.
527 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
528 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of
529 the intrinsic block size of the device.
530 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not
531 valid, or the buffer is not on proper
532 alignment.
533 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
534 lack of resources.
535
536 **/
537 EFI_STATUS
538 EFIAPI
539 ScsiDiskReadBlocksEx (
540 IN EFI_BLOCK_IO2_PROTOCOL *This,
541 IN UINT32 MediaId,
542 IN EFI_LBA Lba,
543 IN OUT EFI_BLOCK_IO2_TOKEN *Token,
544 IN UINTN BufferSize,
545 OUT VOID *Buffer
546 );
547
548 /**
549 The function is to Write Block to SCSI Disk.
550
551 @param This The pointer of EFI_BLOCK_IO_PROTOCOL.
552 @param MediaId The Id of Media detected.
553 @param Lba The logic block address.
554 @param Token A pointer to the token associated with the transaction.
555 @param BufferSize The size of Buffer.
556 @param Buffer The buffer to fill the read out data.
557
558 @retval EFI_SUCCESS The data were written correctly to the device.
559 @retval EFI_WRITE_PROTECTED The device cannot be written to.
560 @retval EFI_NO_MEDIA There is no media in the device.
561 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
562 @retval EFI_DEVICE_ERROR The device reported an error while attempting
563 to perform the write operation.
564 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of
565 the intrinsic block size of the device.
566 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not
567 valid, or the buffer is not on proper
568 alignment.
569
570 **/
571 EFI_STATUS
572 EFIAPI
573 ScsiDiskWriteBlocksEx (
574 IN EFI_BLOCK_IO2_PROTOCOL *This,
575 IN UINT32 MediaId,
576 IN EFI_LBA Lba,
577 IN OUT EFI_BLOCK_IO2_TOKEN *Token,
578 IN UINTN BufferSize,
579 IN VOID *Buffer
580 );
581
582 /**
583 Flush the Block Device.
584
585 @param This Indicates a pointer to the calling context.
586 @param Token A pointer to the token associated with the transaction.
587
588 @retval EFI_SUCCESS All outstanding data was written to the device.
589 @retval EFI_DEVICE_ERROR The device reported an error while attempting to
590 write data.
591 @retval EFI_WRITE_PROTECTED The device cannot be written to.
592 @retval EFI_NO_MEDIA There is no media in the device.
593 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
594
595 **/
596 EFI_STATUS
597 EFIAPI
598 ScsiDiskFlushBlocksEx (
599 IN EFI_BLOCK_IO2_PROTOCOL *This,
600 IN OUT EFI_BLOCK_IO2_TOKEN *Token
601 );
602
603 /**
604 Erase a specified number of device blocks.
605
606 @param[in] This Indicates a pointer to the calling context.
607 @param[in] MediaId The media ID that the erase request is for.
608 @param[in] Lba The starting logical block address to be
609 erased. The caller is responsible for erasing
610 only legitimate locations.
611 @param[in, out] Token A pointer to the token associated with the
612 transaction.
613 @param[in] Size The size in bytes to be erased. This must be
614 a multiple of the physical block size of the
615 device.
616
617 @retval EFI_SUCCESS The erase request was queued if Event is not
618 NULL. The data was erased correctly to the
619 device if the Event is NULL.to the device.
620 @retval EFI_WRITE_PROTECTED The device cannot be erased due to write
621 protection.
622 @retval EFI_DEVICE_ERROR The device reported an error while attempting
623 to perform the erase operation.
624 @retval EFI_INVALID_PARAMETER The erase request contains LBAs that are not
625 valid.
626 @retval EFI_NO_MEDIA There is no media in the device.
627 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
628
629 **/
630 EFI_STATUS
631 EFIAPI
632 ScsiDiskEraseBlocks (
633 IN EFI_ERASE_BLOCK_PROTOCOL *This,
634 IN UINT32 MediaId,
635 IN EFI_LBA Lba,
636 IN OUT EFI_ERASE_BLOCK_TOKEN *Token,
637 IN UINTN Size
638 );
639
640
641 /**
642 Provides inquiry information for the controller type.
643
644 This function is used by the IDE bus driver to get inquiry data. Data format
645 of Identify data is defined by the Interface GUID.
646
647 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
648 @param[in, out] InquiryData Pointer to a buffer for the inquiry data.
649 @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.
650
651 @retval EFI_SUCCESS The command was accepted without any errors.
652 @retval EFI_NOT_FOUND Device does not support this data class
653 @retval EFI_DEVICE_ERROR Error reading InquiryData from device
654 @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough
655
656 **/
657 EFI_STATUS
658 EFIAPI
659 ScsiDiskInfoInquiry (
660 IN EFI_DISK_INFO_PROTOCOL *This,
661 IN OUT VOID *InquiryData,
662 IN OUT UINT32 *InquiryDataSize
663 );
664
665
666 /**
667 Provides identify information for the controller type.
668
669 This function is used by the IDE bus driver to get identify data. Data format
670 of Identify data is defined by the Interface GUID.
671
672 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL
673 instance.
674 @param[in, out] IdentifyData Pointer to a buffer for the identify data.
675 @param[in, out] IdentifyDataSize Pointer to the value for the identify data
676 size.
677
678 @retval EFI_SUCCESS The command was accepted without any errors.
679 @retval EFI_NOT_FOUND Device does not support this data class
680 @retval EFI_DEVICE_ERROR Error reading IdentifyData from device
681 @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough
682
683 **/
684 EFI_STATUS
685 EFIAPI
686 ScsiDiskInfoIdentify (
687 IN EFI_DISK_INFO_PROTOCOL *This,
688 IN OUT VOID *IdentifyData,
689 IN OUT UINT32 *IdentifyDataSize
690 );
691
692
693 /**
694 Provides sense data information for the controller type.
695
696 This function is used by the IDE bus driver to get sense data.
697 Data format of Sense data is defined by the Interface GUID.
698
699 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
700 @param[in, out] SenseData Pointer to the SenseData.
701 @param[in, out] SenseDataSize Size of SenseData in bytes.
702 @param[out] SenseDataNumber Pointer to the value for the sense data size.
703
704 @retval EFI_SUCCESS The command was accepted without any errors.
705 @retval EFI_NOT_FOUND Device does not support this data class.
706 @retval EFI_DEVICE_ERROR Error reading SenseData from device.
707 @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.
708
709 **/
710 EFI_STATUS
711 EFIAPI
712 ScsiDiskInfoSenseData (
713 IN EFI_DISK_INFO_PROTOCOL *This,
714 IN OUT VOID *SenseData,
715 IN OUT UINT32 *SenseDataSize,
716 OUT UINT8 *SenseDataNumber
717 );
718
719 /**
720 This function is used by the IDE bus driver to get controller information.
721
722 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
723 @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.
724 @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.
725
726 @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.
727 @retval EFI_UNSUPPORTED This is not an IDE device.
728
729 **/
730 EFI_STATUS
731 EFIAPI
732 ScsiDiskInfoWhichIde (
733 IN EFI_DISK_INFO_PROTOCOL *This,
734 OUT UINT32 *IdeChannel,
735 OUT UINT32 *IdeDevice
736 );
737
738
739 /**
740 Detect Device and read out capacity ,if error occurs, parse the sense key.
741
742 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
743 @param MustReadCapacity The flag about reading device capacity
744 @param MediaChange The pointer of flag indicates if media has changed
745
746 @retval EFI_DEVICE_ERROR Indicates that error occurs
747 @retval EFI_SUCCESS Successfully to detect media
748
749 **/
750 EFI_STATUS
751 ScsiDiskDetectMedia (
752 IN SCSI_DISK_DEV *ScsiDiskDevice,
753 IN BOOLEAN MustReadCapacity,
754 OUT BOOLEAN *MediaChange
755 );
756
757 /**
758 To test device.
759
760 When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;
761 When Test Unit Ready command encounters any error caused by host adapter or
762 target, return error without retrieving Sense Keys.
763
764 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
765 @param NeedRetry The pointer of flag indicates try again
766 @param SenseDataArray The pointer of an array of sense data
767 @param NumberOfSenseKeys The pointer of the number of sense data array
768
769 @retval EFI_DEVICE_ERROR Indicates that error occurs
770 @retval EFI_SUCCESS Successfully to test unit
771
772 **/
773 EFI_STATUS
774 ScsiDiskTestUnitReady (
775 IN SCSI_DISK_DEV *ScsiDiskDevice,
776 OUT BOOLEAN *NeedRetry,
777 OUT EFI_SCSI_SENSE_DATA **SenseDataArray,
778 OUT UINTN *NumberOfSenseKeys
779 );
780
781
782 /**
783 Parsing Sense Keys which got from request sense command.
784
785 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
786 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
787 @param NumberOfSenseKeys The number of sense key
788 @param Action The pointer of action which indicates what is need to do next
789
790 @retval EFI_DEVICE_ERROR Indicates that error occurs
791 @retval EFI_SUCCESS Successfully to complete the parsing
792
793 **/
794 EFI_STATUS
795 DetectMediaParsingSenseKeys (
796 OUT SCSI_DISK_DEV *ScsiDiskDevice,
797 IN EFI_SCSI_SENSE_DATA *SenseData,
798 IN UINTN NumberOfSenseKeys,
799 OUT UINTN *Action
800 );
801
802
803 /**
804 Send read capacity command to device and get the device parameter.
805
806 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
807 @param NeedRetry The pointer of flag indicates if need a retry
808 @param SenseDataArray The pointer of an array of sense data
809 @param NumberOfSenseKeys The number of sense key
810
811 @retval EFI_DEVICE_ERROR Indicates that error occurs
812 @retval EFI_SUCCESS Successfully to read capacity
813
814 **/
815 EFI_STATUS
816 ScsiDiskReadCapacity (
817 IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
818 OUT BOOLEAN *NeedRetry,
819 OUT EFI_SCSI_SENSE_DATA **SenseDataArray,
820 OUT UINTN *NumberOfSenseKeys
821 );
822
823 /**
824 Check the HostAdapter status and re-interpret it in EFI_STATUS.
825
826 @param HostAdapterStatus Host Adapter status
827
828 @retval EFI_SUCCESS Host adapter is OK.
829 @retval EFI_TIMEOUT Timeout.
830 @retval EFI_NOT_READY Adapter NOT ready.
831 @retval EFI_DEVICE_ERROR Adapter device error.
832
833 **/
834 EFI_STATUS
835 CheckHostAdapterStatus (
836 IN UINT8 HostAdapterStatus
837 );
838
839
840 /**
841 Check the target status and re-interpret it in EFI_STATUS.
842
843 @param TargetStatus Target status
844
845 @retval EFI_NOT_READY Device is NOT ready.
846 @retval EFI_DEVICE_ERROR
847 @retval EFI_SUCCESS
848
849 **/
850 EFI_STATUS
851 CheckTargetStatus (
852 IN UINT8 TargetStatus
853 );
854
855 /**
856 Retrieve all sense keys from the device.
857
858 When encountering error during the process, if retrieve sense keys before
859 error encountered, it returns the sense keys with return status set to EFI_SUCCESS,
860 and NeedRetry set to FALSE; otherwize, return the proper return status.
861
862 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
863 @param NeedRetry The pointer of flag indicates if need a retry
864 @param SenseDataArray The pointer of an array of sense data
865 @param NumberOfSenseKeys The number of sense key
866 @param AskResetIfError The flag indicates if need reset when error occurs
867
868 @retval EFI_DEVICE_ERROR Indicates that error occurs
869 @retval EFI_SUCCESS Successfully to request sense key
870
871 **/
872 EFI_STATUS
873 ScsiDiskRequestSenseKeys (
874 IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
875 OUT BOOLEAN *NeedRetry,
876 OUT EFI_SCSI_SENSE_DATA **SenseDataArray,
877 OUT UINTN *NumberOfSenseKeys,
878 IN BOOLEAN AskResetIfError
879 );
880
881 /**
882 Send out Inquiry command to Device.
883
884 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
885 @param NeedRetry Indicates if needs try again when error happens
886
887 @retval EFI_DEVICE_ERROR Indicates that error occurs
888 @retval EFI_SUCCESS Successfully to detect media
889
890 **/
891 EFI_STATUS
892 ScsiDiskInquiryDevice (
893 IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
894 OUT BOOLEAN *NeedRetry
895 );
896
897 /**
898 Parse Inquiry data.
899
900 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
901
902 **/
903 VOID
904 ParseInquiryData (
905 IN OUT SCSI_DISK_DEV *ScsiDiskDevice
906 );
907
908 /**
909 Read sector from SCSI Disk.
910
911 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
912 @param Buffer The buffer to fill in the read out data
913 @param Lba Logic block address
914 @param NumberOfBlocks The number of blocks to read
915
916 @retval EFI_DEVICE_ERROR Indicates a device error.
917 @retval EFI_SUCCESS Operation is successful.
918
919 **/
920 EFI_STATUS
921 ScsiDiskReadSectors (
922 IN SCSI_DISK_DEV *ScsiDiskDevice,
923 OUT VOID *Buffer,
924 IN EFI_LBA Lba,
925 IN UINTN NumberOfBlocks
926 );
927
928 /**
929 Write sector to SCSI Disk.
930
931 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
932 @param Buffer The buffer of data to be written into SCSI Disk
933 @param Lba Logic block address
934 @param NumberOfBlocks The number of blocks to read
935
936 @retval EFI_DEVICE_ERROR Indicates a device error.
937 @retval EFI_SUCCESS Operation is successful.
938
939 **/
940 EFI_STATUS
941 ScsiDiskWriteSectors (
942 IN SCSI_DISK_DEV *ScsiDiskDevice,
943 IN VOID *Buffer,
944 IN EFI_LBA Lba,
945 IN UINTN NumberOfBlocks
946 );
947
948 /**
949 Asynchronously read sector from SCSI Disk.
950
951 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
952 @param Buffer The buffer to fill in the read out data.
953 @param Lba Logic block address.
954 @param NumberOfBlocks The number of blocks to read.
955 @param Token A pointer to the token associated with the
956 non-blocking read request.
957
958 @retval EFI_INVALID_PARAMETER Token is NULL or Token->Event is NULL.
959 @retval EFI_DEVICE_ERROR Indicates a device error.
960 @retval EFI_SUCCESS Operation is successful.
961
962 **/
963 EFI_STATUS
964 ScsiDiskAsyncReadSectors (
965 IN SCSI_DISK_DEV *ScsiDiskDevice,
966 OUT VOID *Buffer,
967 IN EFI_LBA Lba,
968 IN UINTN NumberOfBlocks,
969 IN EFI_BLOCK_IO2_TOKEN *Token
970 );
971
972 /**
973 Asynchronously write sector to SCSI Disk.
974
975 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
976 @param Buffer The buffer of data to be written into SCSI Disk.
977 @param Lba Logic block address.
978 @param NumberOfBlocks The number of blocks to read.
979 @param Token A pointer to the token associated with the
980 non-blocking read request.
981
982 @retval EFI_INVALID_PARAMETER Token is NULL or Token->Event is NULL
983 @retval EFI_DEVICE_ERROR Indicates a device error.
984 @retval EFI_SUCCESS Operation is successful.
985
986 **/
987 EFI_STATUS
988 ScsiDiskAsyncWriteSectors (
989 IN SCSI_DISK_DEV *ScsiDiskDevice,
990 IN VOID *Buffer,
991 IN EFI_LBA Lba,
992 IN UINTN NumberOfBlocks,
993 IN EFI_BLOCK_IO2_TOKEN *Token
994 );
995
996 /**
997 Submit Read(10) command.
998
999 @param ScsiDiskDevice The pointer of ScsiDiskDevice
1000 @param NeedRetry The pointer of flag indicates if needs retry if error happens
1001 @param Timeout The time to complete the command
1002 @param DataBuffer The buffer to fill with the read out data
1003 @param DataLength The length of buffer
1004 @param StartLba The start logic block address
1005 @param SectorCount The number of blocks to read
1006
1007 @return EFI_STATUS is returned by calling ScsiRead10Command().
1008 **/
1009 EFI_STATUS
1010 ScsiDiskRead10 (
1011 IN SCSI_DISK_DEV *ScsiDiskDevice,
1012 OUT BOOLEAN *NeedRetry,
1013 IN UINT64 Timeout,
1014 OUT UINT8 *DataBuffer,
1015 IN OUT UINT32 *DataLength,
1016 IN UINT32 StartLba,
1017 IN UINT32 SectorCount
1018 );
1019
1020 /**
1021 Submit Write(10) Command.
1022
1023 @param ScsiDiskDevice The pointer of ScsiDiskDevice
1024 @param NeedRetry The pointer of flag indicates if needs retry if error happens
1025 @param Timeout The time to complete the command
1026 @param DataBuffer The buffer to fill with the read out data
1027 @param DataLength The length of buffer
1028 @param StartLba The start logic block address
1029 @param SectorCount The number of blocks to write
1030
1031 @return EFI_STATUS is returned by calling ScsiWrite10Command().
1032
1033 **/
1034 EFI_STATUS
1035 ScsiDiskWrite10 (
1036 IN SCSI_DISK_DEV *ScsiDiskDevice,
1037 OUT BOOLEAN *NeedRetry,
1038 IN UINT64 Timeout,
1039 IN UINT8 *DataBuffer,
1040 IN OUT UINT32 *DataLength,
1041 IN UINT32 StartLba,
1042 IN UINT32 SectorCount
1043 );
1044
1045 /**
1046 Submit Read(16) command.
1047
1048 @param ScsiDiskDevice The pointer of ScsiDiskDevice
1049 @param NeedRetry The pointer of flag indicates if needs retry if error happens
1050 @param Timeout The time to complete the command
1051 @param DataBuffer The buffer to fill with the read out data
1052 @param DataLength The length of buffer
1053 @param StartLba The start logic block address
1054 @param SectorCount The number of blocks to read
1055
1056 @return EFI_STATUS is returned by calling ScsiRead16Command().
1057 **/
1058 EFI_STATUS
1059 ScsiDiskRead16 (
1060 IN SCSI_DISK_DEV *ScsiDiskDevice,
1061 OUT BOOLEAN *NeedRetry,
1062 IN UINT64 Timeout,
1063 OUT UINT8 *DataBuffer,
1064 IN OUT UINT32 *DataLength,
1065 IN UINT64 StartLba,
1066 IN UINT32 SectorCount
1067 );
1068
1069 /**
1070 Submit Write(16) Command.
1071
1072 @param ScsiDiskDevice The pointer of ScsiDiskDevice
1073 @param NeedRetry The pointer of flag indicates if needs retry if error happens
1074 @param Timeout The time to complete the command
1075 @param DataBuffer The buffer to fill with the read out data
1076 @param DataLength The length of buffer
1077 @param StartLba The start logic block address
1078 @param SectorCount The number of blocks to write
1079
1080 @return EFI_STATUS is returned by calling ScsiWrite16Command().
1081
1082 **/
1083 EFI_STATUS
1084 ScsiDiskWrite16 (
1085 IN SCSI_DISK_DEV *ScsiDiskDevice,
1086 OUT BOOLEAN *NeedRetry,
1087 IN UINT64 Timeout,
1088 IN UINT8 *DataBuffer,
1089 IN OUT UINT32 *DataLength,
1090 IN UINT64 StartLba,
1091 IN UINT32 SectorCount
1092 );
1093
1094 /**
1095 Submit Async Read(10) command.
1096
1097 @param ScsiDiskDevice The pointer of ScsiDiskDevice.
1098 @param Timeout The time to complete the command.
1099 @param TimesRetry The number of times the command has been retried.
1100 @param DataBuffer The buffer to fill with the read out data.
1101 @param DataLength The length of buffer.
1102 @param StartLba The start logic block address.
1103 @param SectorCount The number of blocks to read.
1104 @param BlkIo2Req The upstream BlockIo2 request.
1105 @param Token The pointer to the token associated with the
1106 non-blocking read request.
1107
1108 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
1109 lack of resources.
1110 @return others Status returned by calling
1111 ScsiRead10CommandEx().
1112
1113 **/
1114 EFI_STATUS
1115 ScsiDiskAsyncRead10 (
1116 IN SCSI_DISK_DEV *ScsiDiskDevice,
1117 IN UINT64 Timeout,
1118 IN UINT8 TimesRetry,
1119 OUT UINT8 *DataBuffer,
1120 IN UINT32 DataLength,
1121 IN UINT32 StartLba,
1122 IN UINT32 SectorCount,
1123 IN OUT SCSI_BLKIO2_REQUEST *BlkIo2Req,
1124 IN EFI_BLOCK_IO2_TOKEN *Token
1125 );
1126
1127 /**
1128 Submit Async Write(10) command.
1129
1130 @param ScsiDiskDevice The pointer of ScsiDiskDevice.
1131 @param Timeout The time to complete the command.
1132 @param TimesRetry The number of times the command has been retried.
1133 @param DataBuffer The buffer contains the data to write.
1134 @param DataLength The length of buffer.
1135 @param StartLba The start logic block address.
1136 @param SectorCount The number of blocks to write.
1137 @param BlkIo2Req The upstream BlockIo2 request.
1138 @param Token The pointer to the token associated with the
1139 non-blocking read request.
1140
1141 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
1142 lack of resources.
1143 @return others Status returned by calling
1144 ScsiWrite10CommandEx().
1145
1146 **/
1147 EFI_STATUS
1148 ScsiDiskAsyncWrite10 (
1149 IN SCSI_DISK_DEV *ScsiDiskDevice,
1150 IN UINT64 Timeout,
1151 IN UINT8 TimesRetry,
1152 IN UINT8 *DataBuffer,
1153 IN UINT32 DataLength,
1154 IN UINT32 StartLba,
1155 IN UINT32 SectorCount,
1156 IN OUT SCSI_BLKIO2_REQUEST *BlkIo2Req,
1157 IN EFI_BLOCK_IO2_TOKEN *Token
1158 );
1159
1160 /**
1161 Submit Async Read(16) command.
1162
1163 @param ScsiDiskDevice The pointer of ScsiDiskDevice.
1164 @param Timeout The time to complete the command.
1165 @param TimesRetry The number of times the command has been retried.
1166 @param DataBuffer The buffer to fill with the read out data.
1167 @param DataLength The length of buffer.
1168 @param StartLba The start logic block address.
1169 @param SectorCount The number of blocks to read.
1170 @param BlkIo2Req The upstream BlockIo2 request.
1171 @param Token The pointer to the token associated with the
1172 non-blocking read request.
1173
1174 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
1175 lack of resources.
1176 @return others Status returned by calling
1177 ScsiRead16CommandEx().
1178
1179 **/
1180 EFI_STATUS
1181 ScsiDiskAsyncRead16 (
1182 IN SCSI_DISK_DEV *ScsiDiskDevice,
1183 IN UINT64 Timeout,
1184 IN UINT8 TimesRetry,
1185 OUT UINT8 *DataBuffer,
1186 IN UINT32 DataLength,
1187 IN UINT64 StartLba,
1188 IN UINT32 SectorCount,
1189 IN OUT SCSI_BLKIO2_REQUEST *BlkIo2Req,
1190 IN EFI_BLOCK_IO2_TOKEN *Token
1191 );
1192
1193 /**
1194 Submit Async Write(16) command.
1195
1196 @param ScsiDiskDevice The pointer of ScsiDiskDevice.
1197 @param Timeout The time to complete the command.
1198 @param TimesRetry The number of times the command has been retried.
1199 @param DataBuffer The buffer contains the data to write.
1200 @param DataLength The length of buffer.
1201 @param StartLba The start logic block address.
1202 @param SectorCount The number of blocks to write.
1203 @param BlkIo2Req The upstream BlockIo2 request.
1204 @param Token The pointer to the token associated with the
1205 non-blocking read request.
1206
1207 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
1208 lack of resources.
1209 @return others Status returned by calling
1210 ScsiWrite16CommandEx().
1211
1212 **/
1213 EFI_STATUS
1214 ScsiDiskAsyncWrite16 (
1215 IN SCSI_DISK_DEV *ScsiDiskDevice,
1216 IN UINT64 Timeout,
1217 IN UINT8 TimesRetry,
1218 IN UINT8 *DataBuffer,
1219 IN UINT32 DataLength,
1220 IN UINT64 StartLba,
1221 IN UINT32 SectorCount,
1222 IN OUT SCSI_BLKIO2_REQUEST *BlkIo2Req,
1223 IN EFI_BLOCK_IO2_TOKEN *Token
1224 );
1225
1226 /**
1227 Get information from media read capacity command.
1228
1229 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1230 @param Capacity10 The pointer of EFI_SCSI_DISK_CAPACITY_DATA
1231 @param Capacity16 The pointer of EFI_SCSI_DISK_CAPACITY_DATA16
1232 **/
1233 VOID
1234 GetMediaInfo (
1235 IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
1236 IN EFI_SCSI_DISK_CAPACITY_DATA *Capacity10,
1237 IN EFI_SCSI_DISK_CAPACITY_DATA16 *Capacity16
1238 );
1239
1240 /**
1241 Check sense key to find if media presents.
1242
1243 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1244 @param SenseCounts The number of sense key
1245
1246 @retval TRUE NOT any media
1247 @retval FALSE Media presents
1248 **/
1249 BOOLEAN
1250 ScsiDiskIsNoMedia (
1251 IN EFI_SCSI_SENSE_DATA *SenseData,
1252 IN UINTN SenseCounts
1253 );
1254
1255 /**
1256 Parse sense key.
1257
1258 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1259 @param SenseCounts The number of sense key
1260
1261 @retval TRUE Error
1262 @retval FALSE NOT error
1263
1264 **/
1265 BOOLEAN
1266 ScsiDiskIsMediaError (
1267 IN EFI_SCSI_SENSE_DATA *SenseData,
1268 IN UINTN SenseCounts
1269 );
1270
1271 /**
1272 Check sense key to find if hardware error happens.
1273
1274 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1275 @param SenseCounts The number of sense key
1276
1277 @retval TRUE Hardware error exits.
1278 @retval FALSE NO error.
1279
1280 **/
1281 BOOLEAN
1282 ScsiDiskIsHardwareError (
1283 IN EFI_SCSI_SENSE_DATA *SenseData,
1284 IN UINTN SenseCounts
1285 );
1286
1287 /**
1288 Check sense key to find if media has changed.
1289
1290 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1291 @param SenseCounts The number of sense key
1292
1293 @retval TRUE Media is changed.
1294 @retval FALSE Medit is NOT changed.
1295 **/
1296 BOOLEAN
1297 ScsiDiskIsMediaChange (
1298 IN EFI_SCSI_SENSE_DATA *SenseData,
1299 IN UINTN SenseCounts
1300 );
1301
1302 /**
1303 Check sense key to find if reset happens.
1304
1305 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1306 @param SenseCounts The number of sense key
1307
1308 @retval TRUE It is reset before.
1309 @retval FALSE It is NOT reset before.
1310
1311 **/
1312 BOOLEAN
1313 ScsiDiskIsResetBefore (
1314 IN EFI_SCSI_SENSE_DATA *SenseData,
1315 IN UINTN SenseCounts
1316 );
1317
1318 /**
1319 Check sense key to find if the drive is ready.
1320
1321 @param SenseData The pointer of EFI_SCSI_SENSE_DATA
1322 @param SenseCounts The number of sense key
1323 @param RetryLater The flag means if need a retry
1324
1325 @retval TRUE Drive is ready.
1326 @retval FALSE Drive is NOT ready.
1327
1328 **/
1329 BOOLEAN
1330 ScsiDiskIsDriveReady (
1331 IN EFI_SCSI_SENSE_DATA *SenseData,
1332 IN UINTN SenseCounts,
1333 OUT BOOLEAN *RetryLater
1334 );
1335
1336 /**
1337 Check sense key to find if it has sense key.
1338
1339 @param SenseData - The pointer of EFI_SCSI_SENSE_DATA
1340 @param SenseCounts - The number of sense key
1341
1342 @retval TRUE It has sense key.
1343 @retval FALSE It has NOT any sense key.
1344
1345 **/
1346 BOOLEAN
1347 ScsiDiskHaveSenseKey (
1348 IN EFI_SCSI_SENSE_DATA *SenseData,
1349 IN UINTN SenseCounts
1350 );
1351
1352 /**
1353 Release resource about disk device.
1354
1355 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV
1356
1357 **/
1358 VOID
1359 ReleaseScsiDiskDeviceResources (
1360 IN SCSI_DISK_DEV *ScsiDiskDevice
1361 );
1362
1363 /**
1364 Determine if Block Io should be produced.
1365
1366
1367 @param ChildHandle Child Handle to retrieve Parent information.
1368
1369 @retval TRUE Should produce Block Io.
1370 @retval FALSE Should not produce Block Io.
1371
1372 **/
1373 BOOLEAN
1374 DetermineInstallBlockIo (
1375 IN EFI_HANDLE ChildHandle
1376 );
1377
1378 /**
1379 Initialize the installation of DiskInfo protocol.
1380
1381 This function prepares for the installation of DiskInfo protocol on the child handle.
1382 By default, it installs DiskInfo protocol with SCSI interface GUID. If it further
1383 detects that the physical device is an ATAPI/AHCI device, it then updates interface GUID
1384 to be IDE/AHCI interface GUID.
1385
1386 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
1387 @param ChildHandle Child handle to install DiskInfo protocol.
1388
1389 **/
1390 VOID
1391 InitializeInstallDiskInfo (
1392 IN SCSI_DISK_DEV *ScsiDiskDevice,
1393 IN EFI_HANDLE ChildHandle
1394 );
1395
1396 /**
1397 Search protocol database and check to see if the protocol
1398 specified by ProtocolGuid is present on a ControllerHandle and opened by
1399 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
1400 If the ControllerHandle is found, then the protocol specified by ProtocolGuid
1401 will be opened on it.
1402
1403
1404 @param ProtocolGuid ProtocolGuid pointer.
1405 @param ChildHandle Child Handle to retrieve Parent information.
1406
1407 **/
1408 VOID *
1409 EFIAPI
1410 GetParentProtocol (
1411 IN EFI_GUID *ProtocolGuid,
1412 IN EFI_HANDLE ChildHandle
1413 );
1414
1415 /**
1416 Determine if EFI Erase Block Protocol should be produced.
1417
1418 @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
1419 @param ChildHandle Handle of device.
1420
1421 @retval TRUE Should produce EFI Erase Block Protocol.
1422 @retval FALSE Should not produce EFI Erase Block Protocol.
1423
1424 **/
1425 BOOLEAN
1426 DetermineInstallEraseBlock (
1427 IN SCSI_DISK_DEV *ScsiDiskDevice,
1428 IN EFI_HANDLE ChildHandle
1429 );
1430
1431 #endif