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