]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Bus / Ufs / UfsBlockIoPei / UfsBlockIoPei.c
index 9282309e84f522cc756fb694fb66f40dbda3a563..505b92cfc1b8dbcfc37db603a4cb79b3d5a3c3bb 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2018, 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
@@ -153,10 +153,10 @@ UFS_PEIM_HC_PRIVATE_DATA   gUfsHcPeimTemplate = {
 EFI_STATUS\r
 UfsPeimRequestSense (\r
   IN     UFS_PEIM_HC_PRIVATE_DATA        *Private,\r
-  IN     UINTN                           Lun,  \r
+  IN     UINTN                           Lun,\r
      OUT VOID                            *DataBuffer,\r
      OUT UINT32                          *DataBufferLength\r
-  )  \r
+  )\r
 {\r
   UFS_SCSI_REQUEST_PACKET                Packet;\r
   UINT8                                  Cdb[UFS_SCSI_OP_LENGTH_SIX];\r
@@ -201,10 +201,10 @@ UfsPeimRequestSense (
 EFI_STATUS\r
 UfsPeimTestUnitReady (\r
   IN     UFS_PEIM_HC_PRIVATE_DATA        *Private,\r
-  IN     UINTN                           Lun,  \r
+  IN     UINTN                           Lun,\r
      OUT VOID                            *SenseData,  OPTIONAL\r
      OUT UINT8                           *SenseDataLength\r
-  )  \r
+  )\r
 {\r
   UFS_SCSI_REQUEST_PACKET                Packet;\r
   UINT8                                  Cdb[UFS_SCSI_OP_LENGTH_SIX];\r
@@ -254,7 +254,7 @@ UfsPeimInquiry (
      OUT UINT32                       *InquiryLength,\r
      OUT VOID                         *SenseData,  OPTIONAL\r
      OUT UINT8                        *SenseDataLength\r
-  )  \r
+  )\r
 {\r
   UFS_SCSI_REQUEST_PACKET             Packet;\r
   UINT8                               Cdb[UFS_SCSI_OP_LENGTH_SIX];\r
@@ -311,7 +311,7 @@ UfsPeimReadCapacity (
      OUT UINT32                       *DataLength,\r
      OUT VOID                         *SenseData,  OPTIONAL\r
      OUT UINT8                        *SenseDataLength\r
-  )  \r
+  )\r
 {\r
   UFS_SCSI_REQUEST_PACKET             Packet;\r
   UINT8                               Cdb[UFS_SCSI_OP_LENGTH_TEN];\r
@@ -367,7 +367,7 @@ UfsPeimReadCapacity16 (
      OUT UINT32                       *DataLength,\r
      OUT VOID                         *SenseData,  OPTIONAL\r
      OUT UINT8                        *SenseDataLength\r
-  )  \r
+  )\r
 {\r
   UFS_SCSI_REQUEST_PACKET             Packet;\r
   UINT8                               Cdb[UFS_SCSI_OP_LENGTH_SIXTEEN];\r
@@ -429,7 +429,7 @@ UfsPeimRead10 (
      OUT UINT32                       *DataLength,\r
      OUT VOID                         *SenseData,  OPTIONAL\r
      OUT UINT8                        *SenseDataLength\r
-  )  \r
+  )\r
 {\r
   UFS_SCSI_REQUEST_PACKET             Packet;\r
   UINT8                               Cdb[UFS_SCSI_OP_LENGTH_TEN];\r
@@ -491,7 +491,7 @@ UfsPeimRead16 (
      OUT UINT32                       *DataLength,\r
      OUT VOID                         *SenseData,  OPTIONAL\r
      OUT UINT8                        *SenseDataLength\r
-  )  \r
+  )\r
 {\r
   UFS_SCSI_REQUEST_PACKET             Packet;\r
   UINT8                               Cdb[UFS_SCSI_OP_LENGTH_SIXTEEN];\r
@@ -597,16 +597,16 @@ UfsPeimParsingSenseKeys (
 /**\r
   Gets the count of block I/O devices that one specific block driver detects.\r
 \r
-  This function is used for getting the count of block I/O devices that one \r
+  This function is used for getting the count of block I/O devices that one\r
   specific block driver detects.  To the PEI ATAPI driver, it returns the number\r
-  of all the detected ATAPI devices it detects during the enumeration process. \r
-  To the PEI legacy floppy driver, it returns the number of all the legacy \r
-  devices it finds during its enumeration process. If no device is detected, \r
-  then the function will return zero.  \r
-  \r
-  @param[in]  PeiServices          General-purpose services that are available \r
+  of all the detected ATAPI devices it detects during the enumeration process.\r
+  To the PEI legacy floppy driver, it returns the number of all the legacy\r
+  devices it finds during its enumeration process. If no device is detected,\r
+  then the function will return zero.\r
+\r
+  @param[in]  PeiServices          General-purpose services that are available\r
                                    to every PEIM.\r
-  @param[in]  This                 Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI \r
+  @param[in]  This                 Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI\r
                                    instance.\r
   @param[out] NumberBlockDevices   The number of block I/O devices discovered.\r
 \r
@@ -633,41 +633,41 @@ UfsBlockIoPeimGetDeviceNo (
 /**\r
   Gets a block device's media information.\r
 \r
-  This function will provide the caller with the specified block device's media \r
-  information. If the media changes, calling this function will update the media \r
+  This function will provide the caller with the specified block device's media\r
+  information. If the media changes, calling this function will update the media\r
   information accordingly.\r
 \r
   @param[in]  PeiServices   General-purpose services that are available to every\r
                             PEIM\r
   @param[in]  This          Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.\r
-  @param[in]  DeviceIndex   Specifies the block device to which the function wants \r
-                            to talk. Because the driver that implements Block I/O \r
-                            PPIs will manage multiple block devices, the PPIs that \r
-                            want to talk to a single device must specify the \r
+  @param[in]  DeviceIndex   Specifies the block device to which the function wants\r
+                            to talk. Because the driver that implements Block I/O\r
+                            PPIs will manage multiple block devices, the PPIs that\r
+                            want to talk to a single device must specify the\r
                             device index that was assigned during the enumeration\r
-                            process. This index is a number from one to \r
+                            process. This index is a number from one to\r
                             NumberBlockDevices.\r
-  @param[out] MediaInfo     The media information of the specified block media.  \r
-                            The caller is responsible for the ownership of this \r
+  @param[out] MediaInfo     The media information of the specified block media.\r
+                            The caller is responsible for the ownership of this\r
                             data structure.\r
 \r
-  @par Note: \r
-      The MediaInfo structure describes an enumeration of possible block device \r
-      types.  This enumeration exists because no device paths are actually passed \r
-      across interfaces that describe the type or class of hardware that is publishing \r
+  @par Note:\r
+      The MediaInfo structure describes an enumeration of possible block device\r
+      types.  This enumeration exists because no device paths are actually passed\r
+      across interfaces that describe the type or class of hardware that is publishing\r
       the block I/O interface. This enumeration will allow for policy decisions\r
-      in the Recovery PEIM, such as "Try to recover from legacy floppy first, \r
-      LS-120 second, CD-ROM third." If there are multiple partitions abstracted \r
-      by a given device type, they should be reported in ascending order; this \r
-      order also applies to nested partitions, such as legacy MBR, where the \r
-      outermost partitions would have precedence in the reporting order. The \r
-      same logic applies to systems such as IDE that have precedence relationships \r
-      like "Master/Slave" or "Primary/Secondary". The master device should be \r
+      in the Recovery PEIM, such as "Try to recover from legacy floppy first,\r
+      LS-120 second, CD-ROM third." If there are multiple partitions abstracted\r
+      by a given device type, they should be reported in ascending order; this\r
+      order also applies to nested partitions, such as legacy MBR, where the\r
+      outermost partitions would have precedence in the reporting order. The\r
+      same logic applies to systems such as IDE that have precedence relationships\r
+      like "Master/Slave" or "Primary/Secondary". The master device should be\r
       reported first, the slave second.\r
-  \r
-  @retval EFI_SUCCESS        Media information about the specified block device \r
+\r
+  @retval EFI_SUCCESS        Media information about the specified block device\r
                              was obtained successfully.\r
-  @retval EFI_DEVICE_ERROR   Cannot get the media information due to a hardware \r
+  @retval EFI_DEVICE_ERROR   Cannot get the media information due to a hardware\r
                              error.\r
 \r
 **/\r
@@ -687,7 +687,7 @@ UfsBlockIoPeimGetMediaInfo (
   EFI_SCSI_DISK_CAPACITY_DATA        Capacity;\r
   EFI_SCSI_DISK_CAPACITY_DATA16      Capacity16;\r
   UINTN                              DataLength;\r
-  BOOLEAN                            NeedRetry;  \r
+  BOOLEAN                            NeedRetry;\r
 \r
   Private   = GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS (This);\r
   NeedRetry = TRUE;\r
@@ -717,7 +717,7 @@ UfsBlockIoPeimGetMediaInfo (
     if (!EFI_ERROR (Status)) {\r
       break;\r
     }\r
-  \r
+\r
     if (SenseDataLength == 0) {\r
       continue;\r
     }\r
@@ -763,31 +763,31 @@ UfsBlockIoPeimGetMediaInfo (
 /**\r
   Reads the requested number of blocks from the specified block device.\r
 \r
-  The function reads the requested number of blocks from the device. All the \r
+  The function reads the requested number of blocks from the device. All the\r
   blocks are read, or an error is returned. If there is no media in the device,\r
   the function returns EFI_NO_MEDIA.\r
 \r
-  @param[in]  PeiServices   General-purpose services that are available to \r
+  @param[in]  PeiServices   General-purpose services that are available to\r
                             every PEIM.\r
   @param[in]  This          Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.\r
-  @param[in]  DeviceIndex   Specifies the block device to which the function wants \r
-                            to talk. Because the driver that implements Block I/O \r
-                            PPIs will manage multiple block devices, PPIs that \r
-                            want to talk to a single device must specify the device \r
-                            index that was assigned during the enumeration process. \r
+  @param[in]  DeviceIndex   Specifies the block device to which the function wants\r
+                            to talk. Because the driver that implements Block I/O\r
+                            PPIs will manage multiple block devices, PPIs that\r
+                            want to talk to a single device must specify the device\r
+                            index that was assigned during the enumeration process.\r
                             This index is a number from one to NumberBlockDevices.\r
   @param[in]  StartLBA      The starting logical block address (LBA) to read from\r
                             on the device\r
   @param[in]  BufferSize    The size of the Buffer in bytes. This number must be\r
                             a multiple of the intrinsic block size of the device.\r
   @param[out] Buffer        A pointer to the destination buffer for the data.\r
-                            The caller is responsible for the ownership of the \r
+                            The caller is responsible for the ownership of the\r
                             buffer.\r
-                         \r
+\r
   @retval EFI_SUCCESS             The data was read correctly from the device.\r
-  @retval EFI_DEVICE_ERROR        The device reported an error while attempting \r
+  @retval EFI_DEVICE_ERROR        The device reported an error while attempting\r
                                   to perform the read operation.\r
-  @retval EFI_INVALID_PARAMETER   The read request contains LBAs that are not \r
+  @retval EFI_INVALID_PARAMETER   The read request contains LBAs that are not\r
                                   valid, or the buffer is not properly aligned.\r
   @retval EFI_NO_MEDIA            There is no media in the device.\r
   @retval EFI_BAD_BUFFER_SIZE     The BufferSize parameter is not a multiple of\r
@@ -811,7 +811,7 @@ UfsBlockIoPeimReadBlocks (
   UFS_PEIM_HC_PRIVATE_DATA           *Private;\r
   EFI_SCSI_SENSE_DATA                SenseData;\r
   UINT8                              SenseDataLength;\r
-  BOOLEAN                            NeedRetry;  \r
+  BOOLEAN                            NeedRetry;\r
 \r
   Status    = EFI_SUCCESS;\r
   NeedRetry = TRUE;\r
@@ -861,7 +861,7 @@ UfsBlockIoPeimReadBlocks (
     if (!EFI_ERROR (Status)) {\r
       break;\r
     }\r
-  \r
+\r
     if (SenseDataLength == 0) {\r
       continue;\r
     }\r
@@ -903,16 +903,16 @@ UfsBlockIoPeimReadBlocks (
 /**\r
   Gets the count of block I/O devices that one specific block driver detects.\r
 \r
-  This function is used for getting the count of block I/O devices that one \r
+  This function is used for getting the count of block I/O devices that one\r
   specific block driver detects.  To the PEI ATAPI driver, it returns the number\r
-  of all the detected ATAPI devices it detects during the enumeration process. \r
-  To the PEI legacy floppy driver, it returns the number of all the legacy \r
-  devices it finds during its enumeration process. If no device is detected, \r
-  then the function will return zero.  \r
-  \r
-  @param[in]  PeiServices          General-purpose services that are available \r
+  of all the detected ATAPI devices it detects during the enumeration process.\r
+  To the PEI legacy floppy driver, it returns the number of all the legacy\r
+  devices it finds during its enumeration process. If no device is detected,\r
+  then the function will return zero.\r
+\r
+  @param[in]  PeiServices          General-purpose services that are available\r
                                    to every PEIM.\r
-  @param[in]  This                 Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI \r
+  @param[in]  This                 Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI\r
                                    instance.\r
   @param[out] NumberBlockDevices   The number of block I/O devices discovered.\r
 \r
@@ -939,41 +939,41 @@ UfsBlockIoPeimGetDeviceNo2 (
 /**\r
   Gets a block device's media information.\r
 \r
-  This function will provide the caller with the specified block device's media \r
-  information. If the media changes, calling this function will update the media \r
+  This function will provide the caller with the specified block device's media\r
+  information. If the media changes, calling this function will update the media\r
   information accordingly.\r
 \r
   @param[in]  PeiServices   General-purpose services that are available to every\r
                             PEIM\r
   @param[in]  This          Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.\r
-  @param[in]  DeviceIndex   Specifies the block device to which the function wants \r
-                            to talk. Because the driver that implements Block I/O \r
-                            PPIs will manage multiple block devices, the PPIs that \r
-                            want to talk to a single device must specify the \r
+  @param[in]  DeviceIndex   Specifies the block device to which the function wants\r
+                            to talk. Because the driver that implements Block I/O\r
+                            PPIs will manage multiple block devices, the PPIs that\r
+                            want to talk to a single device must specify the\r
                             device index that was assigned during the enumeration\r
-                            process. This index is a number from one to \r
+                            process. This index is a number from one to\r
                             NumberBlockDevices.\r
-  @param[out] MediaInfo     The media information of the specified block media.  \r
-                            The caller is responsible for the ownership of this \r
+  @param[out] MediaInfo     The media information of the specified block media.\r
+                            The caller is responsible for the ownership of this\r
                             data structure.\r
 \r
-  @par Note: \r
-      The MediaInfo structure describes an enumeration of possible block device \r
-      types.  This enumeration exists because no device paths are actually passed \r
-      across interfaces that describe the type or class of hardware that is publishing \r
+  @par Note:\r
+      The MediaInfo structure describes an enumeration of possible block device\r
+      types.  This enumeration exists because no device paths are actually passed\r
+      across interfaces that describe the type or class of hardware that is publishing\r
       the block I/O interface. This enumeration will allow for policy decisions\r
-      in the Recovery PEIM, such as "Try to recover from legacy floppy first, \r
-      LS-120 second, CD-ROM third." If there are multiple partitions abstracted \r
-      by a given device type, they should be reported in ascending order; this \r
-      order also applies to nested partitions, such as legacy MBR, where the \r
-      outermost partitions would have precedence in the reporting order. The \r
-      same logic applies to systems such as IDE that have precedence relationships \r
-      like "Master/Slave" or "Primary/Secondary". The master device should be \r
+      in the Recovery PEIM, such as "Try to recover from legacy floppy first,\r
+      LS-120 second, CD-ROM third." If there are multiple partitions abstracted\r
+      by a given device type, they should be reported in ascending order; this\r
+      order also applies to nested partitions, such as legacy MBR, where the\r
+      outermost partitions would have precedence in the reporting order. The\r
+      same logic applies to systems such as IDE that have precedence relationships\r
+      like "Master/Slave" or "Primary/Secondary". The master device should be\r
       reported first, the slave second.\r
-  \r
-  @retval EFI_SUCCESS        Media information about the specified block device \r
+\r
+  @retval EFI_SUCCESS        Media information about the specified block device\r
                              was obtained successfully.\r
-  @retval EFI_DEVICE_ERROR   Cannot get the media information due to a hardware \r
+  @retval EFI_DEVICE_ERROR   Cannot get the media information due to a hardware\r
                              error.\r
 \r
 **/\r
@@ -991,7 +991,7 @@ UfsBlockIoPeimGetMediaInfo2 (
   EFI_PEI_BLOCK_IO_MEDIA             Media;\r
 \r
   Private   = GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This);\r
-  \r
+\r
   Status    = UfsBlockIoPeimGetMediaInfo (\r
                 PeiServices,\r
                 &Private->BlkIoPpi,\r
@@ -1009,31 +1009,31 @@ UfsBlockIoPeimGetMediaInfo2 (
 /**\r
   Reads the requested number of blocks from the specified block device.\r
 \r
-  The function reads the requested number of blocks from the device. All the \r
+  The function reads the requested number of blocks from the device. All the\r
   blocks are read, or an error is returned. If there is no media in the device,\r
   the function returns EFI_NO_MEDIA.\r
 \r
-  @param[in]  PeiServices   General-purpose services that are available to \r
+  @param[in]  PeiServices   General-purpose services that are available to\r
                             every PEIM.\r
   @param[in]  This          Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.\r
-  @param[in]  DeviceIndex   Specifies the block device to which the function wants \r
-                            to talk. Because the driver that implements Block I/O \r
-                            PPIs will manage multiple block devices, PPIs that \r
-                            want to talk to a single device must specify the device \r
-                            index that was assigned during the enumeration process. \r
+  @param[in]  DeviceIndex   Specifies the block device to which the function wants\r
+                            to talk. Because the driver that implements Block I/O\r
+                            PPIs will manage multiple block devices, PPIs that\r
+                            want to talk to a single device must specify the device\r
+                            index that was assigned during the enumeration process.\r
                             This index is a number from one to NumberBlockDevices.\r
   @param[in]  StartLBA      The starting logical block address (LBA) to read from\r
                             on the device\r
   @param[in]  BufferSize    The size of the Buffer in bytes. This number must be\r
                             a multiple of the intrinsic block size of the device.\r
   @param[out] Buffer        A pointer to the destination buffer for the data.\r
-                            The caller is responsible for the ownership of the \r
+                            The caller is responsible for the ownership of the\r
                             buffer.\r
-                         \r
+\r
   @retval EFI_SUCCESS             The data was read correctly from the device.\r
-  @retval EFI_DEVICE_ERROR        The device reported an error while attempting \r
+  @retval EFI_DEVICE_ERROR        The device reported an error while attempting\r
                                   to perform the read operation.\r
-  @retval EFI_INVALID_PARAMETER   The read request contains LBAs that are not \r
+  @retval EFI_INVALID_PARAMETER   The read request contains LBAs that are not\r
                                   valid, or the buffer is not properly aligned.\r
   @retval EFI_NO_MEDIA            There is no media in the device.\r
   @retval EFI_BAD_BUFFER_SIZE     The BufferSize parameter is not a multiple of\r
@@ -1052,7 +1052,7 @@ UfsBlockIoPeimReadBlocks2 (
   )\r
 {\r
   EFI_STATUS                         Status;\r
-  UFS_PEIM_HC_PRIVATE_DATA           *Private; \r
+  UFS_PEIM_HC_PRIVATE_DATA           *Private;\r
 \r
   Status    = EFI_SUCCESS;\r
   Private   = GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This);\r
@@ -1118,7 +1118,7 @@ UfsEndOfPei (
 \r
 /**\r
   The user code starts with this function.\r
-  \r
+\r
   @param  FileHandle             Handle of the file being invoked.\r
   @param  PeiServices            Describes the list of possible PEI Services.\r
 \r
@@ -1205,8 +1205,8 @@ InitializeUfsBlockIoPeim (
 \r
     //\r
     // UFS 2.0 spec Section 13.1.3.3:\r
-    // At the end of the UFS Interconnect Layer initialization on both host and device side, \r
-    // the host shall send a NOP OUT UPIU to verify that the device UTP Layer is ready. \r
+    // At the end of the UFS Interconnect Layer initialization on both host and device side,\r
+    // the host shall send a NOP OUT UPIU to verify that the device UTP Layer is ready.\r
     //\r
     Status = UfsExecNopCmds (Private);\r
     if (EFI_ERROR (Status)) {\r
@@ -1241,7 +1241,7 @@ InitializeUfsBlockIoPeim (
         DEBUG ((EFI_D_INFO, "Ufs %d Lun %d is enabled\n", Controller, Index));\r
       }\r
     }\r
-    \r
+\r
     PeiServicesInstallPpi (&Private->BlkIoPpiList);\r
     PeiServicesNotifyPpi (&Private->EndOfPeiNotifyList);\r
     Controller++;\r