]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/SmmIoLibSmmCpuIo2/IoLibMmioBuffer.c
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Library / SmmIoLibSmmCpuIo2 / IoLibMmioBuffer.c
index 35b6c0a8a7b29ef53a2b205ef520ab1bd303fe08..5b8ef4402d2320f09d0cce4efaad9f2485520fe6 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   I/O Library MMIO Buffer Functions.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation<BR>\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  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) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -25,9 +19,9 @@
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
 \r
-  @param  StartAddress    Starting address for the MMIO region to be copied from.\r
-  @param  Length          Size in bytes of the copy.\r
-  @param  Buffer          Pointer to a system memory buffer receiving the data read.\r
+  @param  StartAddress    The starting address for the MMIO region to be copied from.\r
+  @param  Length          The size in bytes of the copy.\r
+  @param  Buffer          The pointer to a system memory buffer receiving the data read.\r
 \r
   @return Buffer\r
 \r
 UINT8 *\r
 EFIAPI\r
 MmioReadBuffer8 (\r
-  IN  UINTN       StartAddress,\r
-  IN  UINTN       Length,\r
-  OUT UINT8       *Buffer\r
+  IN  UINTN  StartAddress,\r
+  IN  UINTN  Length,\r
+  OUT UINT8  *Buffer\r
   )\r
 {\r
-  UINT8   *ReturnBuffer;\r
+  UINT8  *ReturnBuffer;\r
 \r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\r
-  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN) Buffer));\r
+  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN)Buffer));\r
 \r
   ReturnBuffer = Buffer;\r
 \r
@@ -67,12 +61,12 @@ MmioReadBuffer8 (
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   If Length is not aligned on a 16-bit boundary, then ASSERT().\r
-  \r
+\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
-  @param  StartAddress    Starting address for the MMIO region to be copied from.\r
-  @param  Length          Size in bytes of the copy.\r
-  @param  Buffer          Pointer to a system memory buffer receiving the data read.\r
+  @param  StartAddress    The starting address for the MMIO region to be copied from.\r
+  @param  Length          The size in bytes of the copy.\r
+  @param  Buffer          The pointer to a system memory buffer receiving the data read.\r
 \r
   @return Buffer\r
 \r
@@ -80,27 +74,27 @@ MmioReadBuffer8 (
 UINT16 *\r
 EFIAPI\r
 MmioReadBuffer16 (\r
-  IN  UINTN       StartAddress,\r
-  IN  UINTN       Length,\r
-  OUT UINT16      *Buffer\r
+  IN  UINTN   StartAddress,\r
+  IN  UINTN   Length,\r
+  OUT UINT16  *Buffer\r
   )\r
 {\r
-  UINT16    *ReturnBuffer;\r
+  UINT16  *ReturnBuffer;\r
 \r
   ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);\r
 \r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\r
-  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN) Buffer));\r
+  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN)Buffer));\r
 \r
   ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);\r
-  ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);\r
+  ASSERT (((UINTN)Buffer & (sizeof (UINT16) - 1)) == 0);\r
 \r
   ReturnBuffer = Buffer;\r
 \r
   while (Length > 0) {\r
-    *(Buffer++) = MmioRead16 (StartAddress);\r
+    *(Buffer++)   = MmioRead16 (StartAddress);\r
     StartAddress += sizeof (UINT16);\r
-    Length -= sizeof (UINT16);\r
+    Length       -= sizeof (UINT16);\r
   }\r
 \r
   return ReturnBuffer;\r
@@ -121,9 +115,9 @@ MmioReadBuffer16 (
   If Length is not aligned on a 32-bit boundary, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
 \r
-  @param  StartAddress    Starting address for the MMIO region to be copied from.\r
-  @param  Length          Size in bytes of the copy.\r
-  @param  Buffer          Pointer to a system memory buffer receiving the data read.\r
+  @param  StartAddress    The starting address for the MMIO region to be copied from.\r
+  @param  Length          The size in bytes of the copy.\r
+  @param  Buffer          The pointer to a system memory buffer receiving the data read.\r
 \r
   @return Buffer\r
 \r
@@ -131,27 +125,27 @@ MmioReadBuffer16 (
 UINT32 *\r
 EFIAPI\r
 MmioReadBuffer32 (\r
-  IN  UINTN       StartAddress,\r
-  IN  UINTN       Length,\r
-  OUT UINT32      *Buffer\r
+  IN  UINTN   StartAddress,\r
+  IN  UINTN   Length,\r
+  OUT UINT32  *Buffer\r
   )\r
 {\r
-  UINT32    *ReturnBuffer;\r
+  UINT32  *ReturnBuffer;\r
 \r
   ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);\r
 \r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\r
-  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN) Buffer));\r
+  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN)Buffer));\r
 \r
   ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);\r
-  ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);\r
+  ASSERT (((UINTN)Buffer & (sizeof (UINT32) - 1)) == 0);\r
 \r
   ReturnBuffer = Buffer;\r
 \r
   while (Length > 0) {\r
-    *(Buffer++) = MmioRead32 (StartAddress);\r
+    *(Buffer++)   = MmioRead32 (StartAddress);\r
     StartAddress += sizeof (UINT32);\r
-    Length -= sizeof (UINT32);\r
+    Length       -= sizeof (UINT32);\r
   }\r
 \r
   return ReturnBuffer;\r
@@ -170,12 +164,12 @@ MmioReadBuffer32 (
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   If Length is not aligned on a 64-bit boundary, then ASSERT().\r
\r
+\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
 \r
-  @param  StartAddress    Starting address for the MMIO region to be copied from.\r
-  @param  Length          Size in bytes of the copy.\r
-  @param  Buffer          Pointer to a system memory buffer receiving the data read.\r
+  @param  StartAddress    The starting address for the MMIO region to be copied from.\r
+  @param  Length          The size in bytes of the copy.\r
+  @param  Buffer          The pointer to a system memory buffer receiving the data read.\r
 \r
   @return Buffer\r
 \r
@@ -183,33 +177,32 @@ MmioReadBuffer32 (
 UINT64 *\r
 EFIAPI\r
 MmioReadBuffer64 (\r
-  IN  UINTN       StartAddress,\r
-  IN  UINTN       Length,\r
-  OUT UINT64      *Buffer\r
+  IN  UINTN   StartAddress,\r
+  IN  UINTN   Length,\r
+  OUT UINT64  *Buffer\r
   )\r
 {\r
-  UINT64    *ReturnBuffer;\r
+  UINT64  *ReturnBuffer;\r
 \r
   ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);\r
 \r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\r
-  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN) Buffer));\r
+  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN)Buffer));\r
 \r
   ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);\r
-  ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);\r
+  ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0);\r
 \r
   ReturnBuffer = Buffer;\r
 \r
   while (Length > 0) {\r
-    *(Buffer++) = MmioRead64 (StartAddress);\r
+    *(Buffer++)   = MmioRead64 (StartAddress);\r
     StartAddress += sizeof (UINT64);\r
-    Length -= sizeof (UINT64);\r
+    Length       -= sizeof (UINT64);\r
   }\r
 \r
   return ReturnBuffer;\r
 }\r
 \r
-\r
 /**\r
   Copy data from system memory to MMIO region by using 8-bit access.\r
 \r
@@ -221,9 +214,10 @@ MmioReadBuffer64 (
   If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r
 \r
 \r
-  @param  StartAddress    Starting address for the MMIO region to be copied to.\r
-  @param  Length     Size in bytes of the copy.\r
-  @param  Buffer          Pointer to a system memory buffer containing the data to write.\r
+  @param  StartAddress    The starting address for the MMIO region to be copied to.\r
+  @param  Length          The size in bytes of the copy.\r
+  @param  Buffer          The pointer to a system memory buffer containing the\r
+                          data to write.\r
 \r
   @return Buffer\r
 \r
@@ -231,24 +225,23 @@ MmioReadBuffer64 (
 UINT8 *\r
 EFIAPI\r
 MmioWriteBuffer8 (\r
-  IN  UINTN         StartAddress,\r
-  IN  UINTN         Length,\r
-  IN  CONST UINT8   *Buffer\r
+  IN  UINTN        StartAddress,\r
+  IN  UINTN        Length,\r
+  IN  CONST UINT8  *Buffer\r
   )\r
 {\r
-  VOIDReturnBuffer;\r
+  VOID  *ReturnBuffer;\r
 \r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\r
-  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN) Buffer));\r
+  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN)Buffer));\r
 \r
-  ReturnBuffer = (UINT8 *) Buffer;\r
+  ReturnBuffer = (UINT8 *)Buffer;\r
 \r
   while (Length-- > 0) {\r
-     MmioWrite8 (StartAddress++, *(Buffer++));\r
+    MmioWrite8 (StartAddress++, *(Buffer++));\r
   }\r
 \r
   return ReturnBuffer;\r
-\r
 }\r
 \r
 /**\r
@@ -267,9 +260,10 @@ MmioWriteBuffer8 (
 \r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
-  @param  StartAddress    Starting address for the MMIO region to be copied to.\r
-  @param  Length     Size in bytes of the copy.\r
-  @param  Buffer          Pointer to a system memory buffer containing the data to write.\r
+  @param  StartAddress    The starting address for the MMIO region to be copied to.\r
+  @param  Length          The size in bytes of the copy.\r
+  @param  Buffer          The pointer to a system memory buffer containing the\r
+                          data to write.\r
 \r
   @return Buffer\r
 \r
@@ -277,34 +271,33 @@ MmioWriteBuffer8 (
 UINT16 *\r
 EFIAPI\r
 MmioWriteBuffer16 (\r
-  IN  UINTN        StartAddress,\r
-  IN  UINTN        Length,\r
-  IN  CONST UINT16 *Buffer\r
+  IN  UINTN         StartAddress,\r
+  IN  UINTN         Length,\r
+  IN  CONST UINT16  *Buffer\r
   )\r
 {\r
-  UINT16    *ReturnBuffer;\r
+  UINT16  *ReturnBuffer;\r
 \r
   ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);\r
 \r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\r
-  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN) Buffer));\r
+  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN)Buffer));\r
 \r
   ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);\r
-  ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);\r
+  ASSERT (((UINTN)Buffer & (sizeof (UINT16) - 1)) == 0);\r
 \r
-  ReturnBuffer = (UINT16 *) Buffer;\r
+  ReturnBuffer = (UINT16 *)Buffer;\r
 \r
   while (Length > 0) {\r
     MmioWrite16 (StartAddress, *(Buffer++));\r
 \r
     StartAddress += sizeof (UINT16);\r
-    Length -= sizeof (UINT16);\r
+    Length       -= sizeof (UINT16);\r
   }\r
 \r
   return ReturnBuffer;\r
 }\r
 \r
-\r
 /**\r
   Copy data from system memory to MMIO region by using 32-bit access.\r
 \r
@@ -321,9 +314,10 @@ MmioWriteBuffer16 (
 \r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
 \r
-  @param  StartAddress    Starting address for the MMIO region to be copied to.\r
-  @param  Length     Size in bytes of the copy.\r
-  @param  Buffer          Pointer to a system memory buffer containing the data to write.\r
+  @param  StartAddress    The starting address for the MMIO region to be copied to.\r
+  @param  Length          The size in bytes of the copy.\r
+  @param  Buffer          The pointer to a system memory buffer containing the\r
+                          data to write.\r
 \r
   @return Buffer\r
 \r
@@ -331,28 +325,28 @@ MmioWriteBuffer16 (
 UINT32 *\r
 EFIAPI\r
 MmioWriteBuffer32 (\r
-  IN  UINTN        StartAddress,\r
-  IN  UINTN        Length,\r
-  IN  CONST UINT32 *Buffer\r
+  IN  UINTN         StartAddress,\r
+  IN  UINTN         Length,\r
+  IN  CONST UINT32  *Buffer\r
   )\r
 {\r
-  UINT32    *ReturnBuffer;\r
+  UINT32  *ReturnBuffer;\r
 \r
   ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);\r
 \r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\r
-  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN) Buffer));\r
+  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN)Buffer));\r
 \r
   ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);\r
-  ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);\r
+  ASSERT (((UINTN)Buffer & (sizeof (UINT32) - 1)) == 0);\r
 \r
-  ReturnBuffer = (UINT32 *) Buffer;\r
+  ReturnBuffer = (UINT32 *)Buffer;\r
 \r
   while (Length > 0) {\r
     MmioWrite32 (StartAddress, *(Buffer++));\r
 \r
     StartAddress += sizeof (UINT32);\r
-    Length -= sizeof (UINT32);\r
+    Length       -= sizeof (UINT32);\r
   }\r
 \r
   return ReturnBuffer;\r
@@ -374,9 +368,10 @@ MmioWriteBuffer32 (
 \r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
 \r
-  @param  StartAddress    Starting address for the MMIO region to be copied to.\r
-  @param  Length     Size in bytes of the copy.\r
-  @param  Buffer          Pointer to a system memory buffer containing the data to write.\r
+  @param  StartAddress    The starting address for the MMIO region to be copied to.\r
+  @param  Length          The size in bytes of the copy.\r
+  @param  Buffer          The pointer to a system memory buffer containing the\r
+                          data to write.\r
 \r
   @return Buffer\r
 \r
@@ -384,30 +379,29 @@ MmioWriteBuffer32 (
 UINT64 *\r
 EFIAPI\r
 MmioWriteBuffer64 (\r
-  IN  UINTN        StartAddress,\r
-  IN  UINTN        Length,\r
-  IN  CONST UINT64 *Buffer\r
+  IN  UINTN         StartAddress,\r
+  IN  UINTN         Length,\r
+  IN  CONST UINT64  *Buffer\r
   )\r
 {\r
-  UINT64    *ReturnBuffer;\r
+  UINT64  *ReturnBuffer;\r
 \r
   ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);\r
 \r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\r
-  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN) Buffer));\r
+  ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN)Buffer));\r
 \r
   ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);\r
-  ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);\r
+  ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0);\r
 \r
-  ReturnBuffer = (UINT64 *) Buffer;\r
+  ReturnBuffer = (UINT64 *)Buffer;\r
 \r
   while (Length > 0) {\r
     MmioWrite64 (StartAddress, *(Buffer++));\r
 \r
     StartAddress += sizeof (UINT64);\r
-    Length -= sizeof (UINT64);\r
+    Length       -= sizeof (UINT64);\r
   }\r
 \r
   return ReturnBuffer;\r
 }\r
-\r