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