]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Scsi / ScsiDiskDxe / ScsiDisk.c
index 2289f20152d309505c788dd77f781d9bdf88b7d2..fbdf927a1114fb5ef268cb3c8dd47850103da44f 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   SCSI disk driver that layers on every SCSI IO protocol in the system.\r
 \r
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
-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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -79,9 +73,9 @@ FreeAlignedBuffer (
 \r
   The user code starts with this function.\r
 \r
-  @param  ImageHandle    The firmware allocated handle for the EFI image.  \r
+  @param  ImageHandle    The firmware allocated handle for the EFI image.\r
   @param  SystemTable    A pointer to the EFI System Table.\r
-  \r
+\r
   @retval EFI_SUCCESS       The entry point is executed successfully.\r
   @retval other             Some error occurs when executing this entry point.\r
 \r
@@ -356,7 +350,7 @@ ScsiDiskDriverBindingStart (
           );\r
         return EFI_SUCCESS;\r
       }\r
-    } \r
+    }\r
   }\r
 \r
   gBS->FreePool (ScsiDiskDevice->SenseData);\r
@@ -368,7 +362,7 @@ ScsiDiskDriverBindingStart (
          Controller\r
          );\r
   return Status;\r
-  \r
+\r
 }\r
 \r
 \r
@@ -380,7 +374,7 @@ ScsiDiskDriverBindingStart (
   restrictions for this service. DisconnectController() must follow these\r
   calling restrictions. If any other agent wishes to call Stop() it must\r
   also follow these calling restrictions.\r
-  \r
+\r
   @param  This              Protocol instance pointer.\r
   @param  ControllerHandle  Handle of device to stop driver on\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
@@ -568,6 +562,7 @@ ScsiDiskReadBlocks (
   MediaChange    = FALSE;\r
   OldTpl         = gBS->RaiseTPL (TPL_CALLBACK);\r
   ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO (This);\r
+  Media          = ScsiDiskDevice->BlkIo.Media;\r
 \r
   if (!IS_DEVICE_FIXED(ScsiDiskDevice)) {\r
 \r
@@ -598,14 +593,17 @@ ScsiDiskReadBlocks (
                &ScsiDiskDevice->EraseBlock\r
                );\r
       }\r
-      Status = EFI_MEDIA_CHANGED;\r
+      if (Media->MediaPresent) {\r
+        Status = EFI_MEDIA_CHANGED;\r
+      } else {\r
+        Status = EFI_NO_MEDIA;\r
+      }\r
       goto Done;\r
     }\r
   }\r
   //\r
   // Get the intrinsic block size\r
   //\r
-  Media           = ScsiDiskDevice->BlkIo.Media;\r
   BlockSize       = Media->BlockSize;\r
 \r
   NumberOfBlocks  = BufferSize / BlockSize;\r
@@ -700,6 +698,7 @@ ScsiDiskWriteBlocks (
   MediaChange    = FALSE;\r
   OldTpl         = gBS->RaiseTPL (TPL_CALLBACK);\r
   ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO (This);\r
+  Media          = ScsiDiskDevice->BlkIo.Media;\r
 \r
   if (!IS_DEVICE_FIXED(ScsiDiskDevice)) {\r
 \r
@@ -730,14 +729,17 @@ ScsiDiskWriteBlocks (
                &ScsiDiskDevice->EraseBlock\r
                );\r
       }\r
-      Status = EFI_MEDIA_CHANGED;\r
+      if (Media->MediaPresent) {\r
+        Status = EFI_MEDIA_CHANGED;\r
+      } else {\r
+        Status = EFI_NO_MEDIA;\r
+      }\r
       goto Done;\r
     }\r
   }\r
   //\r
   // Get the intrinsic block size\r
   //\r
-  Media           = ScsiDiskDevice->BlkIo.Media;\r
   BlockSize       = Media->BlockSize;\r
 \r
   NumberOfBlocks  = BufferSize / BlockSize;\r
@@ -922,6 +924,7 @@ ScsiDiskReadBlocksEx (
   MediaChange    = FALSE;\r
   OldTpl         = gBS->RaiseTPL (TPL_CALLBACK);\r
   ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO2 (This);\r
+  Media          = ScsiDiskDevice->BlkIo.Media;\r
 \r
   if (!IS_DEVICE_FIXED(ScsiDiskDevice)) {\r
 \r
@@ -952,14 +955,17 @@ ScsiDiskReadBlocksEx (
                &ScsiDiskDevice->EraseBlock\r
                );\r
       }\r
-      Status = EFI_MEDIA_CHANGED;\r
+      if (Media->MediaPresent) {\r
+        Status = EFI_MEDIA_CHANGED;\r
+      } else {\r
+        Status = EFI_NO_MEDIA;\r
+      }\r
       goto Done;\r
     }\r
   }\r
   //\r
   // Get the intrinsic block size\r
   //\r
-  Media           = ScsiDiskDevice->BlkIo2.Media;\r
   BlockSize       = Media->BlockSize;\r
 \r
   NumberOfBlocks  = BufferSize / BlockSize;\r
@@ -1081,6 +1087,7 @@ ScsiDiskWriteBlocksEx (
   MediaChange    = FALSE;\r
   OldTpl         = gBS->RaiseTPL (TPL_CALLBACK);\r
   ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO2 (This);\r
+  Media          = ScsiDiskDevice->BlkIo.Media;\r
 \r
   if (!IS_DEVICE_FIXED(ScsiDiskDevice)) {\r
 \r
@@ -1111,14 +1118,17 @@ ScsiDiskWriteBlocksEx (
                &ScsiDiskDevice->EraseBlock\r
                );\r
       }\r
-      Status = EFI_MEDIA_CHANGED;\r
+      if (Media->MediaPresent) {\r
+        Status = EFI_MEDIA_CHANGED;\r
+      } else {\r
+        Status = EFI_NO_MEDIA;\r
+      }\r
       goto Done;\r
     }\r
   }\r
   //\r
   // Get the intrinsic block size\r
   //\r
-  Media           = ScsiDiskDevice->BlkIo2.Media;\r
   BlockSize       = Media->BlockSize;\r
 \r
   NumberOfBlocks  = BufferSize / BlockSize;\r
@@ -1230,6 +1240,7 @@ ScsiDiskFlushBlocksEx (
   MediaChange    = FALSE;\r
   OldTpl         = gBS->RaiseTPL (TPL_CALLBACK);\r
   ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO2 (This);\r
+  Media          = ScsiDiskDevice->BlkIo.Media;\r
 \r
   if (!IS_DEVICE_FIXED(ScsiDiskDevice)) {\r
 \r
@@ -1260,13 +1271,15 @@ ScsiDiskFlushBlocksEx (
                &ScsiDiskDevice->EraseBlock\r
                );\r
       }\r
-      Status = EFI_MEDIA_CHANGED;\r
+      if (Media->MediaPresent) {\r
+        Status = EFI_MEDIA_CHANGED;\r
+      } else {\r
+        Status = EFI_NO_MEDIA;\r
+      }\r
       goto Done;\r
     }\r
   }\r
 \r
-  Media = ScsiDiskDevice->BlkIo2.Media;\r
-\r
   if (!(Media->MediaPresent)) {\r
     Status = EFI_NO_MEDIA;\r
     goto Done;\r
@@ -1701,7 +1714,7 @@ Done:
 \r
   @param  ScsiDiskDevice    The pointer of SCSI_DISK_DEV\r
   @param  MustReadCapacity  The flag about reading device capacity\r
-  @param  MediaChange       The pointer of flag indicates if media has changed \r
+  @param  MediaChange       The pointer of flag indicates if media has changed\r
 \r
   @retval EFI_DEVICE_ERROR  Indicates that error occurs\r
   @retval EFI_SUCCESS       Successfully to detect media\r
@@ -1836,7 +1849,7 @@ ScsiDiskDetectMedia (
         } else {\r
           break;\r
         }\r
-      } else {   \r
+      } else {\r
         Retry++;\r
         if (!NeedRetry || (Retry >= MaxRetry)) {\r
           goto EXIT;\r
@@ -2040,7 +2053,7 @@ ScsiDiskInquiryDevice (
                      EFI_SCSI_PAGE_CODE_BLOCK_LIMITS_VPD\r
                      );\r
           if (!EFI_ERROR (Status)) {\r
-            ScsiDiskDevice->BlkIo.Media->OptimalTransferLengthGranularity = \r
+            ScsiDiskDevice->BlkIo.Media->OptimalTransferLengthGranularity =\r
               (BlockLimits->OptimalTransferLengthGranularity2 << 8) |\r
                BlockLimits->OptimalTransferLengthGranularity1;\r
 \r
@@ -2092,7 +2105,7 @@ ScsiDiskInquiryDevice (
   } else if (Status == EFI_NOT_READY) {\r
     *NeedRetry = TRUE;\r
     return EFI_DEVICE_ERROR;\r
\r
+\r
   } else if ((Status == EFI_INVALID_PARAMETER) || (Status == EFI_UNSUPPORTED)) {\r
     *NeedRetry = FALSE;\r
     return EFI_DEVICE_ERROR;\r
@@ -2128,7 +2141,7 @@ ScsiDiskInquiryDevice (
     *NeedRetry = FALSE;\r
     return EFI_DEVICE_ERROR;\r
   }\r
-  \r
+\r
   //\r
   // if goes here, meant ScsiInquiryCommand() failed.\r
   // if ScsiDiskRequestSenseKeys() succeeds at last,\r
@@ -2284,7 +2297,7 @@ ScsiDiskTestUnitReady (
 \r
   @param  ScsiDiskDevice     The pointer of SCSI_DISK_DEV\r
   @param  SenseData          The pointer of EFI_SCSI_SENSE_DATA\r
-  @param  NumberOfSenseKeys  The number of sense key  \r
+  @param  NumberOfSenseKeys  The number of sense key\r
   @param  Action             The pointer of action which indicates what is need to do next\r
 \r
   @retval EFI_DEVICE_ERROR   Indicates that error occurs\r
@@ -2425,7 +2438,7 @@ ScsiDiskReadCapacity (
   *NeedRetry          = FALSE;\r
 \r
   //\r
-  // submit Read Capacity(10) Command. If it returns capacity of FFFFFFFFh, \r
+  // submit Read Capacity(10) Command. If it returns capacity of FFFFFFFFh,\r
   // 16 byte command should be used to access large hard disk >2TB\r
   //\r
   CommandStatus = ScsiReadCapacityCommand (\r
@@ -2489,12 +2502,12 @@ ScsiDiskReadCapacity (
    // go ahead to check HostAdapterStatus and TargetStatus\r
    // (EFI_TIMEOUT, EFI_DEVICE_ERROR, EFI_WARN_BUFFER_TOO_SMALL)\r
    //\r
\r
+\r
    Status = CheckHostAdapterStatus (HostAdapterStatus);\r
    if ((Status == EFI_TIMEOUT) || (Status == EFI_NOT_READY)) {\r
      *NeedRetry = TRUE;\r
      return EFI_DEVICE_ERROR;\r
\r
+\r
    } else if (Status == EFI_DEVICE_ERROR) {\r
     //\r
     // reset the scsi channel\r
@@ -2517,7 +2530,7 @@ ScsiDiskReadCapacity (
     *NeedRetry = FALSE;\r
     return EFI_DEVICE_ERROR;\r
   }\r
-  \r
+\r
   //\r
   // if goes here, meant ScsiReadCapacityCommand() failed.\r
   // if ScsiDiskRequestSenseKeys() succeeds at last,\r
@@ -2597,7 +2610,7 @@ CheckHostAdapterStatus (
   @param  TargetStatus  Target status\r
 \r
   @retval EFI_NOT_READY       Device is NOT ready.\r
-  @retval EFI_DEVICE_ERROR \r
+  @retval EFI_DEVICE_ERROR\r
   @retval EFI_SUCCESS\r
 \r
 **/\r
@@ -2689,20 +2702,20 @@ ScsiDiskRequestSenseKeys (
               );\r
      if ((Status == EFI_SUCCESS) || (Status == EFI_WARN_BUFFER_TOO_SMALL)) {\r
         FallStatus = EFI_SUCCESS;\r
-  \r
+\r
      } else if ((Status == EFI_TIMEOUT) || (Status == EFI_NOT_READY)) {\r
        *NeedRetry  = TRUE;\r
        FallStatus  = EFI_DEVICE_ERROR;\r
\r
+\r
      } else if ((Status == EFI_INVALID_PARAMETER) || (Status == EFI_UNSUPPORTED)) {\r
        *NeedRetry  = FALSE;\r
        FallStatus  = EFI_DEVICE_ERROR;\r
\r
+\r
      } else if (Status == EFI_DEVICE_ERROR) {\r
         if (AskResetIfError) {\r
           ScsiDiskDevice->ScsiIo->ResetDevice (ScsiDiskDevice->ScsiIo);\r
         }\r
-  \r
+\r
         FallStatus = EFI_DEVICE_ERROR;\r
     }\r
 \r
@@ -2724,7 +2737,7 @@ ScsiDiskRequestSenseKeys (
     // no more sense key or number of sense keys exceeds predefined,\r
     // skip the loop.\r
     //\r
-    if ((PtrSenseData->Sense_Key == EFI_SCSI_SK_NO_SENSE) || \r
+    if ((PtrSenseData->Sense_Key == EFI_SCSI_SK_NO_SENSE) ||\r
         (*NumberOfSenseKeys == ScsiDiskDevice->SenseDataNumber)) {\r
       SenseReq = FALSE;\r
     }\r
@@ -2758,9 +2771,9 @@ GetMediaInfo (
                                               (Capacity10->LastLba2 << 16) |\r
                                               (Capacity10->LastLba1 << 8)  |\r
                                                Capacity10->LastLba0;\r
-  \r
+\r
     ScsiDiskDevice->BlkIo.Media->BlockSize = (Capacity10->BlockSize3 << 24) |\r
-                                             (Capacity10->BlockSize2 << 16) | \r
+                                             (Capacity10->BlockSize2 << 16) |\r
                                              (Capacity10->BlockSize1 << 8)  |\r
                                               Capacity10->BlockSize0;\r
     ScsiDiskDevice->BlkIo.Media->LowestAlignedLba               = 0;\r
@@ -2780,7 +2793,7 @@ GetMediaInfo (
     *Ptr   = Capacity16->LastLba7;\r
 \r
     ScsiDiskDevice->BlkIo.Media->BlockSize = (Capacity16->BlockSize3 << 24) |\r
-                                             (Capacity16->BlockSize2 << 16) | \r
+                                             (Capacity16->BlockSize2 << 16) |\r
                                              (Capacity16->BlockSize1 << 8)  |\r
                                               Capacity16->BlockSize0;\r
 \r
@@ -2851,7 +2864,7 @@ ScsiDiskReadSectors (
 \r
   BlocksRemaining   = NumberOfBlocks;\r
   BlockSize         = ScsiDiskDevice->BlkIo.Media->BlockSize;\r
-  \r
+\r
   //\r
   // limit the data bytes that can be transferred by one Read(10) or Read(16) Command\r
   //\r
@@ -3095,7 +3108,7 @@ ScsiDiskWriteSectors (
                   &ByteCount,\r
                   Lba,\r
                   SectorCount\r
-                  );         \r
+                  );\r
         }\r
       if (!EFI_ERROR (Status)) {\r
         break;\r
@@ -4975,7 +4988,7 @@ ScsiDiskIsHardwareError (
   SensePtr  = SenseData;\r
 \r
   for (Index = 0; Index < SenseCounts; Index++) {\r
-    \r
+\r
     //\r
     // Sense Key is EFI_SCSI_SK_HARDWARE_ERROR (0x4)\r
     //\r
@@ -5052,7 +5065,7 @@ ScsiDiskIsResetBefore (
   SensePtr      = SenseData;\r
 \r
   for (Index = 0; Index < SenseCounts; Index++) {\r
-    \r
+\r
     //\r
     // Sense Key is EFI_SCSI_SK_UNIT_ATTENTION (0x6)\r
     // Additional Sense Code is EFI_SCSI_ASC_RESET (0x29)\r
@@ -5073,7 +5086,7 @@ ScsiDiskIsResetBefore (
 \r
   @param  SenseData    The pointer of EFI_SCSI_SENSE_DATA\r
   @param  SenseCounts  The number of sense key\r
-  @param  RetryLater   The flag means if need a retry \r
+  @param  RetryLater   The flag means if need a retry\r
 \r
   @retval TRUE  Drive is ready.\r
   @retval FALSE Drive is NOT ready.\r
@@ -5168,7 +5181,7 @@ ScsiDiskHaveSenseKey (
   SensePtr = SenseData;\r
 \r
   for (Index = 0; Index < SenseCounts; Index++) {\r
-    \r
+\r
     //\r
     // Sense Key is SK_NO_SENSE (0x0)\r
     //\r
@@ -5215,18 +5228,18 @@ ReleaseScsiDiskDeviceResources (
 \r
 /**\r
   Determine if Block Io & Block Io2 should be produced.\r
-  \r
+\r
 \r
   @param  ChildHandle  Child Handle to retrieve Parent information.\r
-  \r
+\r
   @retval  TRUE    Should produce Block Io & Block Io2.\r
   @retval  FALSE   Should not produce Block Io & Block Io2.\r
 \r
-**/  \r
+**/\r
 BOOLEAN\r
 DetermineInstallBlockIo (\r
   IN  EFI_HANDLE      ChildHandle\r
-  )  \r
+  )\r
 {\r
   EFI_SCSI_PASS_THRU_PROTOCOL           *ScsiPassThru;\r
   EFI_EXT_SCSI_PASS_THRU_PROTOCOL       *ExtScsiPassThru;\r
@@ -5252,7 +5265,7 @@ DetermineInstallBlockIo (
       return TRUE;\r
     }\r
   }\r
-  \r
+\r
   return FALSE;\r
 }\r
 \r
@@ -5261,23 +5274,23 @@ DetermineInstallBlockIo (
   specified by ProtocolGuid is present on a ControllerHandle and opened by\r
   ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
   If the ControllerHandle is found, then the protocol specified by ProtocolGuid\r
-  will be opened on it.  \r
-  \r
+  will be opened on it.\r
+\r
 \r
   @param  ProtocolGuid   ProtocolGuid pointer.\r
   @param  ChildHandle    Child Handle to retrieve Parent information.\r
-  \r
-**/ \r
+\r
+**/\r
 VOID *\r
 EFIAPI\r
 GetParentProtocol (\r
   IN  EFI_GUID                          *ProtocolGuid,\r
   IN  EFI_HANDLE                        ChildHandle\r
-  ) \r
+  )\r
 {\r
   UINTN                                 Index;\r
   UINTN                                 HandleCount;\r
-  VOID                                  *Interface;  \r
+  VOID                                  *Interface;\r
   EFI_STATUS                            Status;\r
   EFI_HANDLE                            *HandleBuffer;\r
 \r
@@ -5297,7 +5310,7 @@ GetParentProtocol (
   }\r
 \r
   //\r
-  // Iterate to find who is parent handle that is opened with ProtocolGuid by ChildHandle \r
+  // Iterate to find who is parent handle that is opened with ProtocolGuid by ChildHandle\r
   //\r
   for (Index = 0; Index < HandleCount; Index++) {\r
     Status = EfiTestChildHandle (HandleBuffer[Index], ChildHandle, ProtocolGuid);\r
@@ -5312,7 +5325,7 @@ GetParentProtocol (
 \r
   gBS->FreePool (HandleBuffer);\r
   return NULL;\r
-} \r
+}\r
 \r
 /**\r
   Determine if EFI Erase Block Protocol should be produced.\r
@@ -5449,7 +5462,7 @@ Done:
 \r
 /**\r
   Provides inquiry information for the controller type.\r
-  \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
@@ -5458,9 +5471,9 @@ Done:
   @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
+  @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
@@ -5492,16 +5505,16 @@ ScsiDiskInfoInquiry (
   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
+  @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
+  @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
@@ -5517,7 +5530,7 @@ ScsiDiskInfoIdentify (
 \r
   if (CompareGuid (&This->Interface, &gEfiDiskInfoScsiInterfaceGuid) || CompareGuid (&This->Interface, &gEfiDiskInfoUfsInterfaceGuid)) {\r
     //\r
-    // Physical SCSI bus does not support this data class. \r
+    // Physical SCSI bus does not support this data class.\r
     //\r
     return EFI_NOT_FOUND;\r
   }\r
@@ -5535,8 +5548,8 @@ ScsiDiskInfoIdentify (
 \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
+\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
@@ -5566,7 +5579,7 @@ ScsiDiskInfoSenseData (
 /**\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[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
@@ -5607,11 +5620,11 @@ ScsiDiskInfoWhichIde (
   via SCSI Request Packet.\r
 \r
   @param  ScsiDiskDevice  The pointer of SCSI_DISK_DEV\r
-  \r
+\r
   @retval EFI_SUCCESS     The ATAPI device identify data were retrieved successfully.\r
   @retval others          Some error occurred during the identification that ATAPI device.\r
 \r
-**/  \r
+**/\r
 EFI_STATUS\r
 AtapiIdentifyDevice (\r
   IN OUT SCSI_DISK_DEV   *ScsiDiskDevice\r
@@ -5647,8 +5660,8 @@ AtapiIdentifyDevice (
 \r
   @param  ScsiDiskDevice  The pointer of SCSI_DISK_DEV.\r
   @param  ChildHandle     Child handle to install DiskInfo protocol.\r
-  \r
-**/  \r
+\r
+**/\r
 VOID\r
 InitializeInstallDiskInfo (\r
   IN  SCSI_DISK_DEV   *ScsiDiskDevice,\r
@@ -5664,7 +5677,7 @@ InitializeInstallDiskInfo (
 \r
   Status = gBS->HandleProtocol (ChildHandle, &gEfiDevicePathProtocolGuid, (VOID **) &DevicePathNode);\r
   //\r
-  // Device Path protocol must be installed on the device handle. \r
+  // Device Path protocol must be installed on the device handle.\r
   //\r
   ASSERT_EFI_ERROR (Status);\r
   //\r
@@ -5696,7 +5709,7 @@ InitializeInstallDiskInfo (
             ScsiDiskDevice->Channel = AtapiDevicePath->PrimarySecondary;\r
             ScsiDiskDevice->Device = AtapiDevicePath->SlaveMaster;\r
             //\r
-            // Update the DiskInfo.Interface to IDE interface GUID for the physical ATAPI device. \r
+            // Update the DiskInfo.Interface to IDE interface GUID for the physical ATAPI device.\r
             //\r
             CopyGuid (&ScsiDiskDevice->DiskInfo.Interface, &gEfiDiskInfoIdeInterfaceGuid);\r
           } else {\r
@@ -5707,7 +5720,7 @@ InitializeInstallDiskInfo (
             ScsiDiskDevice->Channel = SataDevicePath->HBAPortNumber;\r
             ScsiDiskDevice->Device = SataDevicePath->PortMultiplierPortNumber;\r
             //\r
-            // Update the DiskInfo.Interface to AHCI interface GUID for the physical AHCI device. \r
+            // Update the DiskInfo.Interface to AHCI interface GUID for the physical AHCI device.\r
             //\r
             CopyGuid (&ScsiDiskDevice->DiskInfo.Interface, &gEfiDiskInfoAhciInterfaceGuid);\r
           }\r