]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/PeiPciSegmentLibPciCfg2/PciSegmentLib.c
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Library / PeiPciSegmentLibPciCfg2 / PciSegmentLib.c
index 93f63df3895d05a9c10f3a1c661b520b4a501dcc..80cddbefd393b2bf8073e7587665f3f1e0d4d96c 100644 (file)
@@ -1,15 +1,8 @@
 /** @file\r
   PCI Segment Library implementation using PCI CFG2 PPI.\r
 \r
-  Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
-  This program and the accompanying materials are\r
-  licensed and made available under the terms and conditions of\r
-  the BSD License which accompanies this distribution.  The full\r
-  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) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -31,7 +24,7 @@
   @param  M Additional bits to assert to be zero.\r
 \r
 **/\r
-#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \\r
+#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A, M) \\r
   ASSERT (((A) & (0xffff0000f0000000ULL | (M))) == 0)\r
 \r
 /**\r
@@ -49,7 +42,7 @@
 \r
   This internal function retrieves PCI CFG2 PPI from PPI database.\r
 \r
-  @param  Address       The address that encodes the PCI Segment, Bus, Device, \r
+  @param  Address       The address that encodes the PCI Segment, Bus, Device,\r
                         Function and Register.\r
 \r
   @return The pointer to PCI CFG2 PPI.\r
 **/\r
 EFI_PEI_PCI_CFG2_PPI *\r
 InternalGetPciCfg2Ppi (\r
-  IN  UINT64                Address\r
+  IN  UINT64  Address\r
   )\r
 {\r
-  EFI_STATUS                 Status;\r
-  UINTN                      Instance;\r
-  EFI_PEI_PCI_CFG2_PPI       *PciCfg2Ppi;\r
-  UINT64                     SegmentNumber;\r
+  EFI_STATUS            Status;\r
+  UINTN                 Instance;\r
+  EFI_PEI_PCI_CFG2_PPI  *PciCfg2Ppi;\r
+  UINT64                SegmentNumber;\r
 \r
   Instance      = 0;\r
   PciCfg2Ppi    = NULL;\r
@@ -73,11 +66,11 @@ InternalGetPciCfg2Ppi (
   // Loop through all instances of the PPI and match segment number\r
   //\r
   do {\r
-    Status = PeiServicesLocatePpi(\r
+    Status = PeiServicesLocatePpi (\r
                &gEfiPciCfg2PpiGuid,\r
                Instance,\r
                NULL,\r
-               (VOID**) &PciCfg2Ppi\r
+               (VOID **)&PciCfg2Ppi\r
                );\r
     ASSERT_EFI_ERROR (Status);\r
     Instance++;\r
@@ -102,15 +95,15 @@ InternalGetPciCfg2Ppi (
 **/\r
 UINT32\r
 PeiPciSegmentLibPciCfg2ReadWorker (\r
-  IN  UINT64                      Address,\r
-  IN  EFI_PEI_PCI_CFG_PPI_WIDTH   Width\r
+  IN  UINT64                     Address,\r
+  IN  EFI_PEI_PCI_CFG_PPI_WIDTH  Width\r
   )\r
 {\r
-  UINT32                       Data;\r
-  CONST EFI_PEI_PCI_CFG2_PPI   *PciCfg2Ppi;\r
-  UINT64                       PciCfg2Address;\r
+  UINT32                      Data;\r
+  CONST EFI_PEI_PCI_CFG2_PPI  *PciCfg2Ppi;\r
+  UINT64                      PciCfg2Address;\r
 \r
-  PciCfg2Ppi = InternalGetPciCfg2Ppi (Address);\r
+  PciCfg2Ppi     = InternalGetPciCfg2Ppi (Address);\r
   PciCfg2Address = PCI_TO_PCICFG2_ADDRESS (Address);\r
   PciCfg2Ppi->Read (\r
                 GetPeiServicesTablePointer (),\r
@@ -141,15 +134,15 @@ PeiPciSegmentLibPciCfg2ReadWorker (
 **/\r
 UINT32\r
 PeiPciSegmentLibPciCfg2WriteWorker (\r
-  IN  UINT64                      Address,\r
-  IN  EFI_PEI_PCI_CFG_PPI_WIDTH   Width,\r
-  IN  UINT32                      Data\r
+  IN  UINT64                     Address,\r
+  IN  EFI_PEI_PCI_CFG_PPI_WIDTH  Width,\r
+  IN  UINT32                     Data\r
   )\r
 {\r
-  CONST EFI_PEI_PCI_CFG2_PPI   *PciCfg2Ppi;\r
-  UINT64                       PciCfg2Address;\r
+  CONST EFI_PEI_PCI_CFG2_PPI  *PciCfg2Ppi;\r
+  UINT64                      PciCfg2Address;\r
 \r
-  PciCfg2Ppi = InternalGetPciCfg2Ppi (Address);\r
+  PciCfg2Ppi     = InternalGetPciCfg2Ppi (Address);\r
   PciCfg2Address = PCI_TO_PCICFG2_ADDRESS (Address);\r
   PciCfg2Ppi->Write (\r
                 GetPeiServicesTablePointer (),\r
@@ -163,16 +156,16 @@ PeiPciSegmentLibPciCfg2WriteWorker (
 }\r
 \r
 /**\r
-  Register a PCI device so PCI configuration registers may be accessed after \r
+  Register a PCI device so PCI configuration registers may be accessed after\r
   SetVirtualAddressMap().\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
 \r
-  @param  Address The address that encodes the PCI Bus, Device, Function and\r
+  @param  Address Address that encodes the PCI Bus, Device, Function and\r
                   Register.\r
-  \r
+\r
   @retval RETURN_SUCCESS           The PCI device was registered for runtime access.\r
-  @retval RETURN_UNSUPPORTED       An attempt was made to call this function \r
+  @retval RETURN_UNSUPPORTED       An attempt was made to call this function\r
                                    after ExitBootServices().\r
   @retval RETURN_UNSUPPORTED       The resources required to access the PCI device\r
                                    at runtime could not be mapped.\r
@@ -195,11 +188,10 @@ PciSegmentRegisterForRuntimeAccess (
 \r
   Reads and returns the 8-bit PCI configuration register specified by Address.\r
   This function must guarantee that all PCI read and write operations are serialized.\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
-  \r
-  @param  Address   The address that encodes the PCI Segment, Bus, Device, Function, \r
-                    and Register.\r
+\r
+  @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
 \r
   @return The 8-bit PCI configuration register specified by Address.\r
 \r
@@ -207,12 +199,12 @@ PciSegmentRegisterForRuntimeAccess (
 UINT8\r
 EFIAPI\r
 PciSegmentRead8 (\r
-  IN UINT64                    Address\r
+  IN UINT64  Address\r
   )\r
 {\r
   ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0);\r
 \r
-  return (UINT8) PeiPciSegmentLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint8);\r
+  return (UINT8)PeiPciSegmentLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint8);\r
 }\r
 \r
 /**\r
@@ -220,10 +212,10 @@ PciSegmentRead8 (
 \r
   Writes the 8-bit PCI configuration register specified by Address with the value specified by Value.\r
   Value is returned.  This function must guarantee that all PCI read and write operations are serialized.\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
 \r
-  @param  Address     The address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
+  @param  Address     Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
   @param  Value       The value to write.\r
 \r
   @return The value written to the PCI configuration register.\r
@@ -232,13 +224,13 @@ PciSegmentRead8 (
 UINT8\r
 EFIAPI\r
 PciSegmentWrite8 (\r
-  IN UINT64                    Address,\r
-  IN UINT8                     Value\r
+  IN UINT64  Address,\r
+  IN UINT8   Value\r
   )\r
 {\r
   ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0);\r
 \r
-  return (UINT8) PeiPciSegmentLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint8, Value);\r
+  return (UINT8)PeiPciSegmentLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint8, Value);\r
 }\r
 \r
 /**\r
@@ -249,10 +241,10 @@ PciSegmentWrite8 (
   and writes the result to the 8-bit PCI configuration register specified by Address.\r
   The value written to the PCI configuration register is returned.\r
   This function must guarantee that all PCI read and write operations are serialized.\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
 \r
-  @param  Address   The address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
+  @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
   @param  OrData    The value to OR with the PCI configuration register.\r
 \r
   @return The value written to the PCI configuration register.\r
@@ -261,11 +253,11 @@ PciSegmentWrite8 (
 UINT8\r
 EFIAPI\r
 PciSegmentOr8 (\r
-  IN UINT64                    Address,\r
-  IN UINT8                     OrData\r
+  IN UINT64  Address,\r
+  IN UINT8   OrData\r
   )\r
 {\r
-  return PciSegmentWrite8 (Address, (UINT8) (PciSegmentRead8 (Address) | OrData));\r
+  return PciSegmentWrite8 (Address, (UINT8)(PciSegmentRead8 (Address) | OrData));\r
 }\r
 \r
 /**\r
@@ -278,7 +270,7 @@ PciSegmentOr8 (
   This function must guarantee that all PCI read and write operations are serialized.\r
   If any reserved bits in Address are set, then ASSERT().\r
 \r
-  @param  Address   The address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
+  @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
   @param  AndData   The value to AND with the PCI configuration register.\r
 \r
   @return The value written to the PCI configuration register.\r
@@ -287,28 +279,28 @@ PciSegmentOr8 (
 UINT8\r
 EFIAPI\r
 PciSegmentAnd8 (\r
-  IN UINT64                    Address,\r
-  IN UINT8                     AndData\r
+  IN UINT64  Address,\r
+  IN UINT8   AndData\r
   )\r
 {\r
-  return PciSegmentWrite8 (Address, (UINT8) (PciSegmentRead8 (Address) & AndData));\r
+  return PciSegmentWrite8 (Address, (UINT8)(PciSegmentRead8 (Address) & AndData));\r
 }\r
 \r
 /**\r
   Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value,\r
   followed a  bitwise OR with another 8-bit value.\r
-  \r
+\r
   Reads the 8-bit PCI configuration register specified by Address,\r
   performs a bitwise AND between the read result and the value specified by AndData,\r
   performs a bitwise OR between the result of the AND operation and the value specified by OrData,\r
   and writes the result to the 8-bit PCI configuration register specified by Address.\r
   The value written to the PCI configuration register is returned.\r
   This function must guarantee that all PCI read and write operations are serialized.\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
 \r
-  @param  Address   The address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
-  @param  AndData    The value to AND with the PCI configuration register.\r
+  @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
+  @param  AndData   The value to AND with the PCI configuration register.\r
   @param  OrData    The value to OR with the PCI configuration register.\r
 \r
   @return The value written to the PCI configuration register.\r
@@ -317,12 +309,12 @@ PciSegmentAnd8 (
 UINT8\r
 EFIAPI\r
 PciSegmentAndThenOr8 (\r
-  IN UINT64                    Address,\r
-  IN UINT8                     AndData,\r
-  IN UINT8                     OrData\r
+  IN UINT64  Address,\r
+  IN UINT8   AndData,\r
+  IN UINT8   OrData\r
   )\r
 {\r
-  return PciSegmentWrite8 (Address, (UINT8) ((PciSegmentRead8 (Address) & AndData) | OrData));\r
+  return PciSegmentWrite8 (Address, (UINT8)((PciSegmentRead8 (Address) & AndData) | OrData));\r
 }\r
 \r
 /**\r
@@ -337,7 +329,7 @@ PciSegmentAndThenOr8 (
   If EndBit is greater than 7, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to read.\r
+  @param  Address   PCI configuration register to read.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..7.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
@@ -349,9 +341,9 @@ PciSegmentAndThenOr8 (
 UINT8\r
 EFIAPI\r
 PciSegmentBitFieldRead8 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit\r
   )\r
 {\r
   return BitFieldRead8 (PciSegmentRead8 (Address), StartBit, EndBit);\r
@@ -371,12 +363,12 @@ PciSegmentBitFieldRead8 (
   If EndBit is less than StartBit, then ASSERT().\r
   If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to write.\r
+  @param  Address   PCI configuration register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..7.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
                     Range 0..7.\r
-  @param  Value     The new value of the bit field.\r
+  @param  Value     New value of the bit field.\r
 \r
   @return The value written back to the PCI configuration register.\r
 \r
@@ -384,10 +376,10 @@ PciSegmentBitFieldRead8 (
 UINT8\r
 EFIAPI\r
 PciSegmentBitFieldWrite8 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit,\r
-  IN UINT8                     Value\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT8   Value\r
   )\r
 {\r
   return PciSegmentWrite8 (\r
@@ -413,7 +405,7 @@ PciSegmentBitFieldWrite8 (
   If EndBit is less than StartBit, then ASSERT().\r
   If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to write.\r
+  @param  Address   PCI configuration register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..7.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
@@ -426,10 +418,10 @@ PciSegmentBitFieldWrite8 (
 UINT8\r
 EFIAPI\r
 PciSegmentBitFieldOr8 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit,\r
-  IN UINT8                     OrData\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT8   OrData\r
   )\r
 {\r
   return PciSegmentWrite8 (\r
@@ -455,7 +447,7 @@ PciSegmentBitFieldOr8 (
   If EndBit is less than StartBit, then ASSERT().\r
   If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to write.\r
+  @param  Address   PCI configuration register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..7.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
@@ -468,10 +460,10 @@ PciSegmentBitFieldOr8 (
 UINT8\r
 EFIAPI\r
 PciSegmentBitFieldAnd8 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit,\r
-  IN UINT8                     AndData\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT8   AndData\r
   )\r
 {\r
   return PciSegmentWrite8 (\r
@@ -482,8 +474,7 @@ PciSegmentBitFieldAnd8 (
 \r
 /**\r
   Reads a bit field in an 8-bit port, performs a bitwise AND followed by a\r
-  bitwise OR, and writes the result back to the bit field in the\r
-  8-bit port.\r
+  bitwise OR, and writes the result back to the bit field in the 8-bit port.\r
 \r
   Reads the 8-bit PCI configuration register specified by Address, performs a\r
   bitwise AND followed by a bitwise OR between the read result and\r
@@ -500,7 +491,7 @@ PciSegmentBitFieldAnd8 (
   If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
   If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to write.\r
+  @param  Address   PCI configuration register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..7.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
@@ -514,11 +505,11 @@ PciSegmentBitFieldAnd8 (
 UINT8\r
 EFIAPI\r
 PciSegmentBitFieldAndThenOr8 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit,\r
-  IN UINT8                     AndData,\r
-  IN UINT8                     OrData\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT8   AndData,\r
+  IN UINT8   OrData\r
   )\r
 {\r
   return PciSegmentWrite8 (\r
@@ -532,11 +523,11 @@ PciSegmentBitFieldAndThenOr8 (
 \r
   Reads and returns the 16-bit PCI configuration register specified by Address.\r
   This function must guarantee that all PCI read and write operations are serialized.\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
   If Address is not aligned on a 16-bit boundary, then ASSERT().\r
-  \r
-  @param  Address   The address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
+\r
+  @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
 \r
   @return The 16-bit PCI configuration register specified by Address.\r
 \r
@@ -544,12 +535,12 @@ PciSegmentBitFieldAndThenOr8 (
 UINT16\r
 EFIAPI\r
 PciSegmentRead16 (\r
-  IN UINT64                    Address\r
+  IN UINT64  Address\r
   )\r
 {\r
   ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1);\r
 \r
-  return (UINT16) PeiPciSegmentLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint16);\r
+  return (UINT16)PeiPciSegmentLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint16);\r
 }\r
 \r
 /**\r
@@ -557,11 +548,11 @@ PciSegmentRead16 (
 \r
   Writes the 16-bit PCI configuration register specified by Address with the value specified by Value.\r
   Value is returned.  This function must guarantee that all PCI read and write operations are serialized.\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
   If Address is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
-  @param  Address     The address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
+  @param  Address     Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
   @param  Value       The value to write.\r
 \r
   @return The parameter of Value.\r
@@ -570,13 +561,13 @@ PciSegmentRead16 (
 UINT16\r
 EFIAPI\r
 PciSegmentWrite16 (\r
-  IN UINT64                    Address,\r
-  IN UINT16                    Value\r
+  IN UINT64  Address,\r
+  IN UINT16  Value\r
   )\r
 {\r
   ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1);\r
 \r
-  return (UINT16) PeiPciSegmentLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint16, Value);\r
+  return (UINT16)PeiPciSegmentLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint16, Value);\r
 }\r
 \r
 /**\r
@@ -584,16 +575,15 @@ PciSegmentWrite16 (
   a 16-bit value.\r
 \r
   Reads the 16-bit PCI configuration register specified by Address, performs a\r
-  bitwise OR between the read result and the value specified by\r
-  OrData, and writes the result to the 16-bit PCI configuration register\r
-  specified by Address. The value written to the PCI configuration register is\r
-  returned. This function must guarantee that all PCI read and write operations\r
-  are serialized.\r
+  bitwise OR between the read result and the value specified by OrData, and\r
+  writes the result to the 16-bit PCI configuration register specified by Address.\r
+  The value written to the PCI configuration register is returned. This function\r
+  must guarantee that all PCI read and write operations are serialized.\r
 \r
   If any reserved bits in Address are set, then ASSERT().\r
   If Address is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
-  @param  Address The address that encodes the PCI Segment, Bus, Device, Function and\r
+  @param  Address Address that encodes the PCI Segment, Bus, Device, Function and\r
                   Register.\r
   @param  OrData  The value to OR with the PCI configuration register.\r
 \r
@@ -603,11 +593,11 @@ PciSegmentWrite16 (
 UINT16\r
 EFIAPI\r
 PciSegmentOr16 (\r
-  IN UINT64                    Address,\r
-  IN UINT16                    OrData\r
+  IN UINT64  Address,\r
+  IN UINT16  OrData\r
   )\r
 {\r
-  return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) | OrData));\r
+  return PciSegmentWrite16 (Address, (UINT16)(PciSegmentRead16 (Address) | OrData));\r
 }\r
 \r
 /**\r
@@ -618,11 +608,11 @@ PciSegmentOr16 (
   and writes the result to the 16-bit PCI configuration register specified by Address.\r
   The value written to the PCI configuration register is returned.\r
   This function must guarantee that all PCI read and write operations are serialized.\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
   If Address is not aligned on a 16-bit boundary, then ASSERT().\r
-  \r
-  @param  Address   The address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
+\r
+  @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
   @param  AndData   The value to AND with the PCI configuration register.\r
 \r
   @return The value written to the PCI configuration register.\r
@@ -631,28 +621,28 @@ PciSegmentOr16 (
 UINT16\r
 EFIAPI\r
 PciSegmentAnd16 (\r
-  IN UINT64                    Address,\r
-  IN UINT16                    AndData\r
+  IN UINT64  Address,\r
+  IN UINT16  AndData\r
   )\r
 {\r
-  return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) & AndData));\r
+  return PciSegmentWrite16 (Address, (UINT16)(PciSegmentRead16 (Address) & AndData));\r
 }\r
 \r
 /**\r
   Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value,\r
   followed a  bitwise OR with another 16-bit value.\r
-  \r
+\r
   Reads the 16-bit PCI configuration register specified by Address,\r
   performs a bitwise AND between the read result and the value specified by AndData,\r
   performs a bitwise OR between the result of the AND operation and the value specified by OrData,\r
   and writes the result to the 16-bit PCI configuration register specified by Address.\r
   The value written to the PCI configuration register is returned.\r
   This function must guarantee that all PCI read and write operations are serialized.\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
   If Address is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
-  @param  Address   The address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
+  @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
   @param  AndData   The value to AND with the PCI configuration register.\r
   @param  OrData    The value to OR with the PCI configuration register.\r
 \r
@@ -662,12 +652,12 @@ PciSegmentAnd16 (
 UINT16\r
 EFIAPI\r
 PciSegmentAndThenOr16 (\r
-  IN UINT64                    Address,\r
-  IN UINT16                    AndData,\r
-  IN UINT16                    OrData\r
+  IN UINT64  Address,\r
+  IN UINT16  AndData,\r
+  IN UINT16  OrData\r
   )\r
 {\r
-  return PciSegmentWrite16 (Address, (UINT16) ((PciSegmentRead16 (Address) & AndData) | OrData));\r
+  return PciSegmentWrite16 (Address, (UINT16)((PciSegmentRead16 (Address) & AndData) | OrData));\r
 }\r
 \r
 /**\r
@@ -683,7 +673,7 @@ PciSegmentAndThenOr16 (
   If EndBit is greater than 15, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to read.\r
+  @param  Address   PCI configuration register to read.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..15.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
@@ -695,9 +685,9 @@ PciSegmentAndThenOr16 (
 UINT16\r
 EFIAPI\r
 PciSegmentBitFieldRead16 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit\r
   )\r
 {\r
   return BitFieldRead16 (PciSegmentRead16 (Address), StartBit, EndBit);\r
@@ -718,12 +708,12 @@ PciSegmentBitFieldRead16 (
   If EndBit is less than StartBit, then ASSERT().\r
   If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to write.\r
+  @param  Address   PCI configuration register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..15.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
                     Range 0..15.\r
-  @param  Value     The new value of the bit field.\r
+  @param  Value     New value of the bit field.\r
 \r
   @return The value written back to the PCI configuration register.\r
 \r
@@ -731,10 +721,10 @@ PciSegmentBitFieldRead16 (
 UINT16\r
 EFIAPI\r
 PciSegmentBitFieldWrite16 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit,\r
-  IN UINT16                    Value\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT16  Value\r
   )\r
 {\r
   return PciSegmentWrite16 (\r
@@ -744,9 +734,15 @@ PciSegmentBitFieldWrite16 (
 }\r
 \r
 /**\r
-  Reads the 16-bit PCI configuration register specified by Address,\r
-  performs a bitwise OR between the read result and the value specified by OrData,\r
-  and writes the result to the 16-bit PCI configuration register specified by Address. \r
+  Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, writes\r
+  the result back to the bit field in the 16-bit port.\r
+\r
+  Reads the 16-bit PCI configuration register specified by Address, performs a\r
+  bitwise OR between the read result and the value specified by\r
+  OrData, and writes the result to the 16-bit PCI configuration register\r
+  specified by Address. The value written to the PCI configuration register is\r
+  returned. This function must guarantee that all PCI read and write operations\r
+  are serialized. Extra left bits in OrData are stripped.\r
 \r
   If any reserved bits in Address are set, then ASSERT().\r
   If Address is not aligned on a 16-bit boundary, then ASSERT().\r
@@ -755,7 +751,7 @@ PciSegmentBitFieldWrite16 (
   If EndBit is less than StartBit, then ASSERT().\r
   If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to write.\r
+  @param  Address   PCI configuration register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..15.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
@@ -768,10 +764,10 @@ PciSegmentBitFieldWrite16 (
 UINT16\r
 EFIAPI\r
 PciSegmentBitFieldOr16 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit,\r
-  IN UINT16                    OrData\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT16  OrData\r
   )\r
 {\r
   return PciSegmentWrite16 (\r
@@ -781,40 +777,40 @@ PciSegmentBitFieldOr16 (
 }\r
 \r
 /**\r
-  Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR,\r
-  and writes the result back to the bit field in the 16-bit port.\r
+  Reads a bit field in a 16-bit PCI configuration register, performs a bitwise\r
+  AND, writes the result back to the bit field in the 16-bit register.\r
+\r
+  Reads the 16-bit PCI configuration register specified by Address, performs a\r
+  bitwise AND between the read result and the value specified by AndData, and\r
+  writes the result to the 16-bit PCI configuration register specified by\r
+  Address. The value written to the PCI configuration register is returned.\r
+  This function must guarantee that all PCI read and write operations are\r
+  serialized. Extra left bits in AndData are stripped.\r
 \r
-  Reads the 16-bit PCI configuration register specified by Address,\r
-  performs a bitwise OR between the read result and the value specified by OrData,\r
-  and writes the result to the 16-bit PCI configuration register specified by Address.\r
-  The value written to the PCI configuration register is returned.\r
-  This function must guarantee that all PCI read and write operations are serialized.\r
-  Extra left bits in OrData are stripped.\r
-  \r
   If any reserved bits in Address are set, then ASSERT().\r
   If Address is not aligned on a 16-bit boundary, then ASSERT().\r
-  If StartBit is greater than 7, then ASSERT().\r
-  If EndBit is greater than 7, then ASSERT().\r
+  If StartBit is greater than 15, then ASSERT().\r
+  If EndBit is greater than 15, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
   If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
-  @param  Address   The address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
+  @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
-                    The ordinal of the least significant bit in a byte is bit 0.\r
+                    Range 0..15.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
-                    The ordinal of the most significant bit in a byte is bit 7.\r
-  @param  AndData   The value to AND with the read value from the PCI configuration register.\r
+                    Range 0..15.\r
+  @param  AndData   The value to AND with the PCI configuration register.\r
 \r
-  @return The value written to the PCI configuration register.\r
+  @return The value written back to the PCI configuration register.\r
 \r
 **/\r
 UINT16\r
 EFIAPI\r
 PciSegmentBitFieldAnd16 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit,\r
-  IN UINT16                    AndData\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT16  AndData\r
   )\r
 {\r
   return PciSegmentWrite16 (\r
@@ -843,7 +839,7 @@ PciSegmentBitFieldAnd16 (
   If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
   If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to write.\r
+  @param  Address   PCI configuration register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..15.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
@@ -857,11 +853,11 @@ PciSegmentBitFieldAnd16 (
 UINT16\r
 EFIAPI\r
 PciSegmentBitFieldAndThenOr16 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit,\r
-  IN UINT16                    AndData,\r
-  IN UINT16                    OrData\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT16  AndData,\r
+  IN UINT16  OrData\r
   )\r
 {\r
   return PciSegmentWrite16 (\r
@@ -875,12 +871,11 @@ PciSegmentBitFieldAndThenOr16 (
 \r
   Reads and returns the 32-bit PCI configuration register specified by Address.\r
   This function must guarantee that all PCI read and write operations are serialized.\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
   If Address is not aligned on a 32-bit boundary, then ASSERT().\r
 \r
-  @param  Address   The address that encodes the PCI Segment, Bus, Device, Function, \r
-                    and Register.\r
+  @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
 \r
   @return The 32-bit PCI configuration register specified by Address.\r
 \r
@@ -888,7 +883,7 @@ PciSegmentBitFieldAndThenOr16 (
 UINT32\r
 EFIAPI\r
 PciSegmentRead32 (\r
-  IN UINT64                    Address\r
+  IN UINT64  Address\r
   )\r
 {\r
   ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3);\r
@@ -901,12 +896,11 @@ PciSegmentRead32 (
 \r
   Writes the 32-bit PCI configuration register specified by Address with the value specified by Value.\r
   Value is returned.  This function must guarantee that all PCI read and write operations are serialized.\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
   If Address is not aligned on a 32-bit boundary, then ASSERT().\r
 \r
-  @param  Address     The address that encodes the PCI Segment, Bus, Device, \r
-                      Function, and Register.\r
+  @param  Address     Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
   @param  Value       The value to write.\r
 \r
   @return The parameter of Value.\r
@@ -915,8 +909,8 @@ PciSegmentRead32 (
 UINT32\r
 EFIAPI\r
 PciSegmentWrite32 (\r
-  IN UINT64                    Address,\r
-  IN UINT32                    Value\r
+  IN UINT64  Address,\r
+  IN UINT32  Value\r
   )\r
 {\r
   ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3);\r
@@ -932,11 +926,11 @@ PciSegmentWrite32 (
   and writes the result to the 32-bit PCI configuration register specified by Address.\r
   The value written to the PCI configuration register is returned.\r
   This function must guarantee that all PCI read and write operations are serialized.\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
   If Address is not aligned on a 32-bit boundary, then ASSERT().\r
 \r
-  @param  Address   The address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
+  @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
   @param  OrData    The value to OR with the PCI configuration register.\r
 \r
   @return The value written to the PCI configuration register.\r
@@ -945,8 +939,8 @@ PciSegmentWrite32 (
 UINT32\r
 EFIAPI\r
 PciSegmentOr32 (\r
-  IN UINT64                    Address,\r
-  IN UINT32                    OrData\r
+  IN UINT64  Address,\r
+  IN UINT32  OrData\r
   )\r
 {\r
   return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) | OrData);\r
@@ -960,12 +954,11 @@ PciSegmentOr32 (
   and writes the result to the 32-bit PCI configuration register specified by Address.\r
   The value written to the PCI configuration register is returned.\r
   This function must guarantee that all PCI read and write operations are serialized.\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
   If Address is not aligned on a 32-bit boundary, then ASSERT().\r
 \r
-  @param  Address   The address that encodes the PCI Segment, Bus, Device, Function, \r
-                    and Register.\r
+  @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
   @param  AndData   The value to AND with the PCI configuration register.\r
 \r
   @return The value written to the PCI configuration register.\r
@@ -974,8 +967,8 @@ PciSegmentOr32 (
 UINT32\r
 EFIAPI\r
 PciSegmentAnd32 (\r
-  IN UINT64                    Address,\r
-  IN UINT32                    AndData\r
+  IN UINT64  Address,\r
+  IN UINT32  AndData\r
   )\r
 {\r
   return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) & AndData);\r
@@ -984,19 +977,18 @@ PciSegmentAnd32 (
 /**\r
   Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value,\r
   followed a  bitwise OR with another 32-bit value.\r
-  \r
+\r
   Reads the 32-bit PCI configuration register specified by Address,\r
   performs a bitwise AND between the read result and the value specified by AndData,\r
   performs a bitwise OR between the result of the AND operation and the value specified by OrData,\r
   and writes the result to the 32-bit PCI configuration register specified by Address.\r
   The value written to the PCI configuration register is returned.\r
   This function must guarantee that all PCI read and write operations are serialized.\r
-  \r
+\r
   If any reserved bits in Address are set, then ASSERT().\r
   If Address is not aligned on a 32-bit boundary, then ASSERT().\r
 \r
-  @param  Address   The address that encodes the PCI Segment, Bus, Device, Function,\r
-                    and Register.\r
+  @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
   @param  AndData   The value to AND with the PCI configuration register.\r
   @param  OrData    The value to OR with the PCI configuration register.\r
 \r
@@ -1006,9 +998,9 @@ PciSegmentAnd32 (
 UINT32\r
 EFIAPI\r
 PciSegmentAndThenOr32 (\r
-  IN UINT64                    Address,\r
-  IN UINT32                    AndData,\r
-  IN UINT32                    OrData\r
+  IN UINT64  Address,\r
+  IN UINT32  AndData,\r
+  IN UINT32  OrData\r
   )\r
 {\r
   return PciSegmentWrite32 (Address, (PciSegmentRead32 (Address) & AndData) | OrData);\r
@@ -1027,7 +1019,7 @@ PciSegmentAndThenOr32 (
   If EndBit is greater than 31, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to read.\r
+  @param  Address   PCI configuration register to read.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..31.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
@@ -1039,9 +1031,9 @@ PciSegmentAndThenOr32 (
 UINT32\r
 EFIAPI\r
 PciSegmentBitFieldRead32 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit\r
   )\r
 {\r
   return BitFieldRead32 (PciSegmentRead32 (Address), StartBit, EndBit);\r
@@ -1062,12 +1054,12 @@ PciSegmentBitFieldRead32 (
   If EndBit is less than StartBit, then ASSERT().\r
   If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to write.\r
+  @param  Address   PCI configuration register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..31.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
                     Range 0..31.\r
-  @param  Value     The new value of the bit field.\r
+  @param  Value     New value of the bit field.\r
 \r
   @return The value written back to the PCI configuration register.\r
 \r
@@ -1075,10 +1067,10 @@ PciSegmentBitFieldRead32 (
 UINT32\r
 EFIAPI\r
 PciSegmentBitFieldWrite32 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit,\r
-  IN UINT32                    Value\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT32  Value\r
   )\r
 {\r
   return PciSegmentWrite32 (\r
@@ -1104,7 +1096,7 @@ PciSegmentBitFieldWrite32 (
   If EndBit is less than StartBit, then ASSERT().\r
   If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to write.\r
+  @param  Address   PCI configuration register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..31.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
@@ -1117,10 +1109,10 @@ PciSegmentBitFieldWrite32 (
 UINT32\r
 EFIAPI\r
 PciSegmentBitFieldOr32 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit,\r
-  IN UINT32                    OrData\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT32  OrData\r
   )\r
 {\r
   return PciSegmentWrite32 (\r
@@ -1133,7 +1125,7 @@ PciSegmentBitFieldOr32 (
   Reads a bit field in a 32-bit PCI configuration register, performs a bitwise\r
   AND, and writes the result back to the bit field in the 32-bit register.\r
 \r
-  \r
+\r
   Reads the 32-bit PCI configuration register specified by Address, performs a bitwise\r
   AND between the read result and the value specified by AndData, and writes the result\r
   to the 32-bit PCI configuration register specified by Address. The value written to\r
@@ -1146,7 +1138,7 @@ PciSegmentBitFieldOr32 (
   If EndBit is less than StartBit, then ASSERT().\r
   If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to write.\r
+  @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..31.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
@@ -1159,10 +1151,10 @@ PciSegmentBitFieldOr32 (
 UINT32\r
 EFIAPI\r
 PciSegmentBitFieldAnd32 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit,\r
-  IN UINT32                    AndData\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT32  AndData\r
   )\r
 {\r
   return PciSegmentWrite32 (\r
@@ -1191,7 +1183,7 @@ PciSegmentBitFieldAnd32 (
   If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
   If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
-  @param  Address   The PCI configuration register to write.\r
+  @param  Address   PCI configuration register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
                     Range 0..31.\r
   @param  EndBit    The ordinal of the most significant bit in the bit field.\r
@@ -1205,11 +1197,11 @@ PciSegmentBitFieldAnd32 (
 UINT32\r
 EFIAPI\r
 PciSegmentBitFieldAndThenOr32 (\r
-  IN UINT64                    Address,\r
-  IN UINTN                     StartBit,\r
-  IN UINTN                     EndBit,\r
-  IN UINT32                    AndData,\r
-  IN UINT32                    OrData\r
+  IN UINT64  Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT32  AndData,\r
+  IN UINT32  OrData\r
   )\r
 {\r
   return PciSegmentWrite32 (\r
@@ -1233,10 +1225,10 @@ PciSegmentBitFieldAndThenOr32 (
   If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().\r
   If Size > 0 and Buffer is NULL, then ASSERT().\r
 \r
-  @param  StartAddress  The starting address that encodes the PCI Segment, Bus, \r
-                        Device, Function and Register.\r
-  @param  Size          The size in bytes of the transfer.\r
-  @param  Buffer        The pointer to a buffer receiving the data read.\r
+  @param  StartAddress  Starting address that encodes the PCI Segment, Bus, Device,\r
+                        Function and Register.\r
+  @param  Size          Size in bytes of the transfer.\r
+  @param  Buffer        Pointer to a buffer receiving the data read.\r
 \r
   @return Size\r
 \r
@@ -1244,12 +1236,12 @@ PciSegmentBitFieldAndThenOr32 (
 UINTN\r
 EFIAPI\r
 PciSegmentReadBuffer (\r
-  IN  UINT64                   StartAddress,\r
-  IN  UINTN                    Size,\r
-  OUT VOID                     *Buffer\r
+  IN  UINT64  StartAddress,\r
+  IN  UINTN   Size,\r
+  OUT VOID    *Buffer\r
   )\r
 {\r
-  UINTN                             ReturnValue;\r
+  UINTN  ReturnValue;\r
 \r
   ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0);\r
   ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);\r
@@ -1270,19 +1262,19 @@ PciSegmentReadBuffer (
     // Read a byte if StartAddress is byte aligned\r
     //\r
     *(volatile UINT8 *)Buffer = PciSegmentRead8 (StartAddress);\r
-    StartAddress += sizeof (UINT8);\r
-    Size -= sizeof (UINT8);\r
-    Buffer = (UINT8*)Buffer + 1;\r
+    StartAddress             += sizeof (UINT8);\r
+    Size                     -= sizeof (UINT8);\r
+    Buffer                    = (UINT8 *)Buffer + 1;\r
   }\r
 \r
-  if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {\r
+  if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {\r
     //\r
     // Read a word if StartAddress is word aligned\r
     //\r
     WriteUnaligned16 (Buffer, PciSegmentRead16 (StartAddress));\r
     StartAddress += sizeof (UINT16);\r
-    Size -= sizeof (UINT16);\r
-    Buffer = (UINT16*)Buffer + 1;\r
+    Size         -= sizeof (UINT16);\r
+    Buffer        = (UINT16 *)Buffer + 1;\r
   }\r
 \r
   while (Size >= sizeof (UINT32)) {\r
@@ -1291,8 +1283,8 @@ PciSegmentReadBuffer (
     //\r
     WriteUnaligned32 (Buffer, PciSegmentRead32 (StartAddress));\r
     StartAddress += sizeof (UINT32);\r
-    Size -= sizeof (UINT32);\r
-    Buffer = (UINT32*)Buffer + 1;\r
+    Size         -= sizeof (UINT32);\r
+    Buffer        = (UINT32 *)Buffer + 1;\r
   }\r
 \r
   if (Size >= sizeof (UINT16)) {\r
@@ -1301,8 +1293,8 @@ PciSegmentReadBuffer (
     //\r
     WriteUnaligned16 (Buffer, PciSegmentRead16 (StartAddress));\r
     StartAddress += sizeof (UINT16);\r
-    Size -= sizeof (UINT16);\r
-    Buffer = (UINT16*)Buffer + 1;\r
+    Size         -= sizeof (UINT16);\r
+    Buffer        = (UINT16 *)Buffer + 1;\r
   }\r
 \r
   if (Size >= sizeof (UINT8)) {\r
@@ -1315,7 +1307,6 @@ PciSegmentReadBuffer (
   return ReturnValue;\r
 }\r
 \r
-\r
 /**\r
   Copies the data in a caller supplied buffer to a specified range of PCI\r
   configuration space.\r
@@ -1332,10 +1323,10 @@ PciSegmentReadBuffer (
   If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().\r
   If Size > 0 and Buffer is NULL, then ASSERT().\r
 \r
-  @param  StartAddress  The starting address that encodes the PCI Segment, Bus, \r
-                        Device, Function and Register.\r
-  @param  Size          The size in bytes of the transfer.\r
-  @param  Buffer        The pointer to a buffer containing the data to write.\r
+  @param  StartAddress  Starting address that encodes the PCI Segment, Bus, Device,\r
+                        Function and Register.\r
+  @param  Size          Size in bytes of the transfer.\r
+  @param  Buffer        Pointer to a buffer containing the data to write.\r
 \r
   @return The parameter of Size.\r
 \r
@@ -1343,12 +1334,12 @@ PciSegmentReadBuffer (
 UINTN\r
 EFIAPI\r
 PciSegmentWriteBuffer (\r
-  IN UINT64                    StartAddress,\r
-  IN UINTN                     Size,\r
-  IN VOID                      *Buffer\r
+  IN UINT64  StartAddress,\r
+  IN UINTN   Size,\r
+  IN VOID    *Buffer\r
   )\r
 {\r
-  UINTN                             ReturnValue;\r
+  UINTN  ReturnValue;\r
 \r
   ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0);\r
   ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);\r
@@ -1368,20 +1359,20 @@ PciSegmentWriteBuffer (
     //\r
     // Write a byte if StartAddress is byte aligned\r
     //\r
-    PciSegmentWrite8 (StartAddress, *(UINT8*)Buffer);\r
+    PciSegmentWrite8 (StartAddress, *(UINT8 *)Buffer);\r
     StartAddress += sizeof (UINT8);\r
-    Size -= sizeof (UINT8);\r
-    Buffer = (UINT8*)Buffer + 1;\r
+    Size         -= sizeof (UINT8);\r
+    Buffer        = (UINT8 *)Buffer + 1;\r
   }\r
 \r
-  if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {\r
+  if ((Size >= sizeof (UINT16)) && ((StartAddress & BIT1) != 0)) {\r
     //\r
     // Write a word if StartAddress is word aligned\r
     //\r
     PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer));\r
     StartAddress += sizeof (UINT16);\r
-    Size -= sizeof (UINT16);\r
-    Buffer = (UINT16*)Buffer + 1;\r
+    Size         -= sizeof (UINT16);\r
+    Buffer        = (UINT16 *)Buffer + 1;\r
   }\r
 \r
   while (Size >= sizeof (UINT32)) {\r
@@ -1390,8 +1381,8 @@ PciSegmentWriteBuffer (
     //\r
     PciSegmentWrite32 (StartAddress, ReadUnaligned32 (Buffer));\r
     StartAddress += sizeof (UINT32);\r
-    Size -= sizeof (UINT32);\r
-    Buffer = (UINT32*)Buffer + 1;\r
+    Size         -= sizeof (UINT32);\r
+    Buffer        = (UINT32 *)Buffer + 1;\r
   }\r
 \r
   if (Size >= sizeof (UINT16)) {\r
@@ -1400,15 +1391,15 @@ PciSegmentWriteBuffer (
     //\r
     PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer));\r
     StartAddress += sizeof (UINT16);\r
-    Size -= sizeof (UINT16);\r
-    Buffer = (UINT16*)Buffer + 1;\r
+    Size         -= sizeof (UINT16);\r
+    Buffer        = (UINT16 *)Buffer + 1;\r
   }\r
 \r
   if (Size >= sizeof (UINT8)) {\r
     //\r
     // Write the last remaining byte if exist\r
     //\r
-    PciSegmentWrite8 (StartAddress, *(UINT8*)Buffer);\r
+    PciSegmentWrite8 (StartAddress, *(UINT8 *)Buffer);\r
   }\r
 \r
   return ReturnValue;\r