]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
1. Eliminate RemainingDevicePath Type limitation, let PassThru to check its validation.
[mirror_edk2.git] / MdeModulePkg / Bus / Scsi / ScsiDiskDxe / ScsiDisk.h
index c5761c2cec483f08a14c24885cd0f3fd052620ad..a7bc94313aa1ded578c88aee469e6cb6dbfac412 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Header file for SCSI Disk Driver.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2004 - 2009, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -25,6 +25,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/DriverBinding.h>\r
 #include <Protocol/ScsiPassThruExt.h>\r
 #include <Protocol/ScsiPassThru.h>\r
+#include <Protocol/DiskInfo.h>\r
+\r
 \r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
@@ -33,8 +35,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/UefiScsiLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/DevicePathLib.h>\r
 \r
 #include <IndustryStandard/Scsi.h>\r
+#include <IndustryStandard/Atapi.h>\r
 \r
 #define IS_DEVICE_FIXED(a)        (a)->FixedDevice ? 1 : 0\r
 \r
@@ -58,10 +62,20 @@ typedef struct {
 \r
   EFI_UNICODE_STRING_TABLE  *ControllerNameTable;\r
 \r
+  EFI_DISK_INFO_PROTOCOL    DiskInfo;\r
+\r
+  //\r
+  // The following fields are only valid for ATAPI/SATA device\r
+  //\r
+  UINT32                    Channel;\r
+  UINT32                    Device;\r
+  ATAPI_IDENTIFY_DATA       IdentifyData;\r
 } SCSI_DISK_DEV;\r
 \r
 #define SCSI_DISK_DEV_FROM_THIS(a)  CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)\r
 \r
+#define SCSI_DISK_DEV_FROM_DISKINFO(a) CR (a, SCSI_DISK_DEV, DiskInfo, SCSI_DISK_DEV_SIGNATURE)\r
+\r
 //\r
 // Global Variables\r
 //\r
@@ -385,8 +399,107 @@ ScsiDiskFlushBlocks (
   IN  EFI_BLOCK_IO_PROTOCOL   *This\r
   );\r
 \r
+\r
+/**\r
+  Provides inquiry information for the controller type.\r
+  \r
+  This function is used by the IDE bus driver to get inquiry data.  Data format\r
+  of Identify data is defined by the Interface GUID.\r
+\r
+  @param[in]     This              Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
+  @param[in,out] InquiryData       Pointer to a buffer for the inquiry data.\r
+  @param[in,out] InquiryDataSize   Pointer to the value for the inquiry data size.\r
+\r
+  @retval EFI_SUCCESS            The command was accepted without any errors.\r
+  @retval EFI_NOT_FOUND          Device does not support this data class \r
+  @retval EFI_DEVICE_ERROR       Error reading InquiryData from device \r
+  @retval EFI_BUFFER_TOO_SMALL   InquiryDataSize not big enough \r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ScsiDiskInfoInquiry (\r
+  IN     EFI_DISK_INFO_PROTOCOL   *This,\r
+  IN OUT VOID                     *InquiryData,\r
+  IN OUT UINT32                   *InquiryDataSize\r
+  );\r
+\r
+\r
+/**\r
+  Provides identify information for the controller type.\r
+\r
+  This function is used by the IDE bus driver to get identify data.  Data format\r
+  of Identify data is defined by the Interface GUID.\r
+\r
+  @param[in]     This               Pointer to the EFI_DISK_INFO_PROTOCOL \r
+                                    instance.\r
+  @param[in,out] IdentifyData       Pointer to a buffer for the identify data.\r
+  @param[in,out] IdentifyDataSize   Pointer to the value for the identify data\r
+                                    size.\r
+\r
+  @retval EFI_SUCCESS            The command was accepted without any errors.\r
+  @retval EFI_NOT_FOUND          Device does not support this data class \r
+  @retval EFI_DEVICE_ERROR       Error reading IdentifyData from device \r
+  @retval EFI_BUFFER_TOO_SMALL   IdentifyDataSize not big enough \r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ScsiDiskInfoIdentify (\r
+  IN     EFI_DISK_INFO_PROTOCOL   *This,\r
+  IN OUT VOID                     *IdentifyData,\r
+  IN OUT UINT32                   *IdentifyDataSize\r
+  );\r
+\r
+\r
+/**\r
+  Provides sense data information for the controller type.\r
+  \r
+  This function is used by the IDE bus driver to get sense data. \r
+  Data format of Sense data is defined by the Interface GUID.\r
+\r
+  @param[in]     This              Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
+  @param[in,out] SenseData         Pointer to the SenseData.\r
+  @param[in,out] SenseDataSize     Size of SenseData in bytes.\r
+  @param[out]    SenseDataNumber   Pointer to the value for the sense data size.\r
+\r
+  @retval EFI_SUCCESS            The command was accepted without any errors.\r
+  @retval EFI_NOT_FOUND          Device does not support this data class.\r
+  @retval EFI_DEVICE_ERROR       Error reading SenseData from device.\r
+  @retval EFI_BUFFER_TOO_SMALL   SenseDataSize not big enough.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ScsiDiskInfoSenseData (\r
+  IN     EFI_DISK_INFO_PROTOCOL   *This,\r
+  IN OUT VOID                     *SenseData,\r
+  IN OUT UINT32                   *SenseDataSize,\r
+  OUT    UINT8                    *SenseDataNumber\r
+  );\r
+\r
+/**\r
+  This function is used by the IDE bus driver to get controller information.\r
+\r
+  @param[in]  This         Pointer to the EFI_DISK_INFO_PROTOCOL instance. \r
+  @param[out] IdeChannel   Pointer to the Ide Channel number.  Primary or secondary.\r
+  @param[out] IdeDevice    Pointer to the Ide Device number.  Master or slave.\r
+\r
+  @retval EFI_SUCCESS       IdeChannel and IdeDevice are valid.\r
+  @retval EFI_UNSUPPORTED   This is not an IDE device.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ScsiDiskInfoWhichIde (\r
+  IN  EFI_DISK_INFO_PROTOCOL   *This,\r
+  OUT UINT32                   *IdeChannel,\r
+  OUT UINT32                   *IdeDevice\r
+  );\r
+\r
+\r
 /**\r
-  Dectect Device and read out capacity ,if error occurs, parse the sense key.\r
+  Detect Device and read out capacity ,if error occurs, parse the sense key.\r
 \r
   @param  ScsiDiskDevice    The pointer of SCSI_DISK_DEV\r
   @param  MustReadCapacity  The flag about reading device capacity\r
@@ -404,7 +517,7 @@ ScsiDiskDetectMedia (
   );\r
 \r
 /**\r
-  To test deivice.\r
+  To test device.\r
 \r
   When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;\r
   When Test Unit Ready command encounters any error caused by host adapter or\r
@@ -505,7 +618,7 @@ CheckTargetStatus (
   Retrieve all sense keys from the device.\r
 \r
   When encountering error during the process, if retrieve sense keys before\r
-  error encounterred, it returns the sense keys with return status set to EFI_SUCCESS,\r
+  error encountered, it returns the sense keys with return status set to EFI_SUCCESS,\r
   and NeedRetry set to FALSE; otherwize, return the proper return status.\r
 \r
   @param  ScsiDiskDevice     The pointer of SCSI_DISK_DEV\r
@@ -557,7 +670,7 @@ ParseInquiryData (
 /**\r
   Read sector from SCSI Disk.\r
 \r
-  @param  ScsiDiskDevice  The poiniter of SCSI_DISK_DEV\r
+  @param  ScsiDiskDevice  The pointer of SCSI_DISK_DEV\r
   @param  Buffer          The buffer to fill in the read out data\r
   @param  Lba             Logic block address\r
   @param  NumberOfBlocks  The number of blocks to read\r
@@ -577,7 +690,7 @@ ScsiDiskReadSectors (
 /**\r
   Write sector to SCSI Disk.\r
 \r
-  @param  ScsiDiskDevice  The poiniter of SCSI_DISK_DEV\r
+  @param  ScsiDiskDevice  The pointer of SCSI_DISK_DEV\r
   @param  Buffer          The buffer of data to be written into SCSI Disk\r
   @param  Lba             Logic block address\r
   @param  NumberOfBlocks  The number of blocks to read\r
@@ -595,7 +708,7 @@ ScsiDiskWriteSectors (
   );\r
 \r
 /**\r
-  Sumbmit Read command.\r
+  Submit Read command.\r
 \r
   @param  ScsiDiskDevice     The pointer of ScsiDiskDevice\r
   @param  NeedRetry          The pointer of flag indicates if needs retry if error happens\r
@@ -792,7 +905,7 @@ ReleaseScsiDiskDeviceResources (
   Determine if Block Io should be produced.\r
   \r
 \r
-  @param  ChildHandle  Child Handle to retrive Parent information.\r
+  @param  ChildHandle  Child Handle to retrieve Parent information.\r
   \r
   @retval  TRUE    Should produce Block Io.\r
   @retval  FALSE   Should not produce Block Io.\r
@@ -803,6 +916,24 @@ DetermineInstallBlockIo (
   IN  EFI_HANDLE      ChildHandle\r
   );\r
 \r
+/**\r
+  Initialize the installation of DiskInfo protocol.\r
+\r
+  This function prepares for the installation of DiskInfo protocol on the child handle.\r
+  By default, it installs DiskInfo protocol with SCSI interface GUID. If it further\r
+  detects that the physical device is an ATAPI/AHCI device, it then updates interface GUID\r
+  to be IDE/AHCI interface GUID.\r
+\r
+  @param  ScsiDiskDevice  The pointer of SCSI_DISK_DEV.\r
+  @param  ChildHandle     Child handle to install DiskInfo protocol.\r
+  \r
+**/  \r
+VOID\r
+InitializeInstallDiskInfo (\r
+  IN  SCSI_DISK_DEV   *ScsiDiskDevice,\r
+  IN  EFI_HANDLE      ChildHandle\r
+  ); \r
+\r
 /**\r
   Search protocol database and check to see if the protocol\r
   specified by ProtocolGuid is present on a ControllerHandle and opened by\r