]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / IdeBusPei / AtapiPeim.c
index 58bef161fb37e8a2228aa1c41394d1f167b7f0c6..f509b749d2e59cc9b7ecf886a3245db9c80535c4 100644 (file)
@@ -5,7 +5,7 @@ ATA controllers in the platform.
 This PPI can be consumed by PEIM which produce gEfiPeiDeviceRecoveryModulePpiGuid\r
 for Atapi CD ROM device.\r
 \r
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -21,8 +21,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "AtapiPeim.h"\r
 \r
 /**\r
-  Initializes the Atapi Block Io PPI.  \r
-  \r
+  Initializes the Atapi Block Io PPI.\r
+\r
   @param[in]  FileHandle           Handle of the file being invoked.\r
   @param[in]  PeiServices          Describes the list of possible PEI Services.\r
 \r
@@ -97,16 +97,16 @@ AtapiPeimEntry (
 /**\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
@@ -135,27 +135,27 @@ AtapiGetNumberOfBlockDevices (
 /**\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
-  @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
   @retval Others                Other failure occurs.\r
 \r
@@ -196,7 +196,7 @@ AtapiGetBlockDeviceMediaInfo (
   //\r
   // probe media and retrieve latest media information\r
   //\r
-  DEBUG ((EFI_D_INFO, "Atatpi GetInfo DevicePosition is %d\n", AtapiBlkIoDev->DeviceInfo[Index].DevicePosition));  \r
+  DEBUG ((EFI_D_INFO, "Atatpi GetInfo DevicePosition is %d\n", AtapiBlkIoDev->DeviceInfo[Index].DevicePosition));\r
   DEBUG ((EFI_D_INFO, "Atatpi GetInfo DeviceType is   %d\n", AtapiBlkIoDev->DeviceInfo[Index].MediaInfo.DeviceType));\r
   DEBUG ((EFI_D_INFO, "Atatpi GetInfo MediaPresent is %d\n", AtapiBlkIoDev->DeviceInfo[Index].MediaInfo.MediaPresent));\r
   DEBUG ((EFI_D_INFO, "Atatpi GetInfo BlockSize is  0x%x\n", AtapiBlkIoDev->DeviceInfo[Index].MediaInfo.BlockSize));\r
@@ -217,7 +217,7 @@ AtapiGetBlockDeviceMediaInfo (
   DEBUG ((EFI_D_INFO, "Atatpi GetInfo MediaPresent is %d\n", AtapiBlkIoDev->DeviceInfo[Index].MediaInfo.MediaPresent));\r
   DEBUG ((EFI_D_INFO, "Atatpi GetInfo BlockSize is  0x%x\n", AtapiBlkIoDev->DeviceInfo[Index].MediaInfo.BlockSize));\r
   DEBUG ((EFI_D_INFO, "Atatpi GetInfo LastBlock is  0x%x\n", AtapiBlkIoDev->DeviceInfo[Index].MediaInfo.LastBlock));\r
-  \r
+\r
   //\r
   // Get media info from AtapiBlkIoDev\r
   //\r
@@ -229,31 +229,31 @@ AtapiGetBlockDeviceMediaInfo (
 /**\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, the 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, the 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
@@ -553,7 +553,7 @@ AtapiEnumerateDevices (
                                   );\r
 \r
   //\r
-  // Allow SATA Devices to spin-up. This is needed if \r
+  // Allow SATA Devices to spin-up. This is needed if\r
   // SEC and PEI phase is too short, for example Release Build.\r
   //\r
   DEBUG ((EFI_D_INFO, "Delay for %d seconds for SATA devices to spin-up\n", PcdGet16 (PcdSataSpinUpDelayInSecForRecoveryPath)));\r
@@ -571,7 +571,7 @@ AtapiEnumerateDevices (
   //\r
   // Using Command and Control Regs Base Address to fill other registers.\r
   //\r
-  for (Index1 = 0; Index1 < IdeEnabledNumber; Index1 ++) { \r
+  for (Index1 = 0; Index1 < IdeEnabledNumber; Index1 ++) {\r
     CommandBlockBaseAddr               = IdeRegsBaseAddr[Index1].CommandBlockBaseAddr;\r
     AtapiBlkIoDev->IdeIoPortReg[Index1].Data         = CommandBlockBaseAddr;\r
     AtapiBlkIoDev->IdeIoPortReg[Index1].Reg1.Feature = (UINT16) (CommandBlockBaseAddr + 0x1);\r
@@ -585,7 +585,7 @@ AtapiEnumerateDevices (
     ControlBlockBaseAddr                = IdeRegsBaseAddr[Index1].ControlBlockBaseAddr;\r
     AtapiBlkIoDev->IdeIoPortReg[Index1].Alt.DeviceControl = ControlBlockBaseAddr;\r
     AtapiBlkIoDev->IdeIoPortReg[Index1].DriveAddress      = (UINT16) (ControlBlockBaseAddr + 0x1);\r
-    \r
+\r
     //\r
     // Scan IDE bus for ATAPI devices IDE or Sata device\r
     //\r
@@ -628,7 +628,7 @@ AtapiEnumerateDevices (
 \r
 /**\r
   Detect Atapi devices.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev   A pointer to atapi block IO device.\r
   @param[in]  DevicePosition  An integer to signify device position.\r
   @param[out] MediaInfo       The media information of the specified block media.\r
@@ -667,7 +667,7 @@ DiscoverAtapiDevice (
 \r
 /**\r
   Check power mode of Atapi devices.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev   A pointer to atapi block IO device.\r
   @param[in]  DevicePosition  An integer to signify device position.\r
   @param[in]  AtaCommand      The Ata Command passed in.\r
@@ -800,7 +800,7 @@ CheckPowerMode (
 \r
 /**\r
   Detect if an IDE controller exists in specified position.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev   A pointer to atapi block IO device.\r
   @param[in]  DevicePosition  An integer to signify device position.\r
 \r
@@ -842,7 +842,7 @@ DetectIDEController (
 \r
 /**\r
   Wait specified time interval to poll for BSY bit clear in the Status Register.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev          A pointer to atapi block IO device.\r
   @param[in]  IdeIoRegisters         A pointer to IDE IO registers.\r
   @param[in]  TimeoutInMilliSeconds  Time specified in milliseconds.\r
@@ -887,7 +887,7 @@ WaitForBSYClear (
 \r
 /**\r
   Wait specified time interval to poll for DRDY bit set in the Status register.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev          A pointer to atapi block IO device.\r
   @param[in]  IdeIoRegisters         A pointer to IDE IO registers.\r
   @param[in]  TimeoutInMilliSeconds  Time specified in milliseconds.\r
@@ -928,7 +928,7 @@ DRDYReady (
     return EFI_ABORTED;\r
     }\r
   }\r
-  \r
+\r
     MicroSecondDelay (250);\r
 \r
     Delay--;\r
@@ -944,7 +944,7 @@ DRDYReady (
 \r
 /**\r
   Wait specified time interval to poll for DRQ bit clear in the Status Register.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev          A pointer to atapi block IO device.\r
   @param[in]  IdeIoRegisters         A pointer to IDE IO registers.\r
   @param[in]  TimeoutInMilliSeconds  Time specified in milliseconds.\r
@@ -987,7 +987,7 @@ DRQClear (
     return EFI_ABORTED;\r
     }\r
   }\r
-  \r
+\r
     MicroSecondDelay (250);\r
 \r
     Delay--;\r
@@ -1002,7 +1002,7 @@ DRQClear (
 \r
 /**\r
   Wait specified time interval to poll for DRQ bit clear in the Alternate Status Register.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev          A pointer to atapi block IO device.\r
   @param[in]  IdeIoRegisters         A pointer to IDE IO registers.\r
   @param[in]  TimeoutInMilliSeconds  Time specified in milliseconds.\r
@@ -1045,7 +1045,7 @@ DRQClear2 (
     return EFI_ABORTED;\r
     }\r
   }\r
-  \r
+\r
     MicroSecondDelay (250);\r
 \r
     Delay--;\r
@@ -1406,7 +1406,7 @@ TestUnitReady (
 \r
 /**\r
   Send out ATAPI commands conforms to the Packet Command with PIO Data In Protocol.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev         A pointer to atapi block IO device.\r
   @param[in]  DevicePosition        An integer to signify device position.\r
   @param[in]  Packet                A pointer to ATAPI command packet.\r
@@ -1702,8 +1702,8 @@ Inquiry (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**  \r
-  Used before read/write blocks from/to ATAPI device media. \r
+/**\r
+  Used before read/write blocks from/to ATAPI device media.\r
   Since ATAPI device media is removable, it is necessary to detect\r
   whether media is present and get current present media's information.\r
 \r
@@ -1739,7 +1739,7 @@ DetectMedia (
   if (SenseBuffers == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  \r
+\r
   //\r
   // Test Unit Ready command is used to detect whether device is accessible,\r
   // the device will produce corresponding Sense data.\r
@@ -1878,7 +1878,7 @@ DetectMedia (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**  \r
+/**\r
   Reset specified Atapi device.\r
 \r
   @param[in]  AtapiBlkIoDev     A pointer to atapi block IO device.\r
@@ -1976,7 +1976,7 @@ ResetDevice (
 \r
 }\r
 \r
-/**  \r
+/**\r
   Sends out ATAPI Request Sense Packet Command to the specified device.\r
 \r
   @param[in]      AtapiBlkIoDev   A pointer to atapi block IO device.\r
@@ -2072,7 +2072,7 @@ RequestSense (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**  \r
+/**\r
   Sends out ATAPI Read Capacity Packet Command to the specified device.\r
   This command will return the information regarding the capacity of the\r
   media in the device.\r
@@ -2185,7 +2185,7 @@ ReadCapacity (
   }\r
 }\r
 \r
-/**  \r
+/**\r
   Perform read from disk in block unit.\r
 \r
   @param[in]  AtapiBlkIoDev   A pointer to atapi block IO device.\r
@@ -2288,7 +2288,7 @@ ReadSectors (
   return Status;\r
 }\r
 \r
-/**  \r
+/**\r
   Check if there is media according to sense data.\r
 \r
   @param[in]  SenseData   Pointer to sense data.\r
@@ -2324,14 +2324,14 @@ IsNoMedia (
   return IsNoMedia;\r
 }\r
 \r
-/**  \r
+/**\r
   Check if device state is unclear according to sense data.\r
 \r
   @param[in]  SenseData   Pointer to sense data.\r
   @param[in]  SenseCounts Count of sense data.\r
 \r
   @retval TRUE    Device state is unclear\r
-  @retval FALSE   Device state is clear  \r
+  @retval FALSE   Device state is clear\r
 \r
 **/\r
 BOOLEAN\r
@@ -2365,7 +2365,7 @@ IsDeviceStateUnclear (
   return Unclear;\r
 }\r
 \r
-/**  \r
+/**\r
   Check if there is media error according to sense data.\r
 \r
   @param[in]  SenseData   Pointer to sense data.\r
@@ -2438,7 +2438,7 @@ IsMediaError (
   return IsError;\r
 }\r
 \r
-/**  \r
+/**\r
   Check if drive is ready according to sense data.\r
 \r
   @param[in]  SenseData   Pointer to sense data.\r