]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/PeiIoLibCpuIo/IoLibMmioBuffer.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / PeiIoLibCpuIo / IoLibMmioBuffer.c
index 972d620119acd68dc089aa52e8a07212f746b2e2..f4ee7c37f49950e88363414c081f5f26ff20b2d6 100644 (file)
@@ -2,14 +2,8 @@
   I/O Library MMIO Buffer Functions.\r
   The implementations are based on EFI_PEI_SERVICE->CpuIo interface.\r
 \r
-  Copyright (c) 2007 - 2009, 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) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 /**\r
   Copy data from MMIO region to system memory by using 8-bit access.\r
 \r
-  Copy data from MMIO region specified by starting address StartAddress \r
-  to system memory specified by Buffer by using 8-bit access. The total \r
+  Copy data from MMIO region specified by starting address StartAddress\r
+  to system memory specified by Buffer by using 8-bit access. The total\r
   number of byte to be copied is specified by Length. Buffer is returned.\r
-  \r
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+\r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
   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  StartAddress    The starting address for the MMIO region to be copied from.\r
   @param  Length          The size, in bytes, of Buffer.\r
-  @param  Buffer          Pointer to a system memory buffer receiving the data read.\r
+  @param  Buffer          The pointer to a system memory buffer receiving the data read.\r
 \r
   @return Buffer\r
 \r
@@ -51,9 +45,9 @@ MmioReadBuffer8 (
 \r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN) Buffer));\r
\r
+\r
   ReturnBuffer = Buffer;\r
-  \r
+\r
   while (Length-- != 0) {\r
     *(Buffer++) = MmioRead8 (StartAddress++);\r
   }\r
@@ -64,21 +58,21 @@ MmioReadBuffer8 (
 /**\r
   Copy data from MMIO region to system memory by using 16-bit access.\r
 \r
-  Copy data from MMIO region specified by starting address StartAddress \r
-  to system memory specified by Buffer by using 16-bit access. The total \r
+  Copy data from MMIO region specified by starting address StartAddress\r
+  to system memory specified by Buffer by using 16-bit access. The total\r
   number of byte to be copied is specified by Length. Buffer is returned.\r
-  \r
+\r
   If StartAddress is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
   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
   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  StartAddress    The starting address for the MMIO region to be copied from.\r
   @param  Length          The size, in bytes, of Buffer.\r
-  @param  Buffer          Pointer to a system memory buffer receiving the data read.\r
+  @param  Buffer          The pointer to a system memory buffer receiving the data read.\r
 \r
   @return Buffer\r
 \r
@@ -94,15 +88,15 @@ MmioReadBuffer16 (
   UINT16    *ReturnBuffer;\r
 \r
   ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);\r
-  \r
+\r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\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
\r
+\r
   ReturnBuffer = Buffer;\r
-  \r
+\r
   while (Length != 0) {\r
     *(Buffer++) = MmioRead16 (StartAddress);\r
     StartAddress += sizeof (UINT16);\r
@@ -115,21 +109,21 @@ MmioReadBuffer16 (
 /**\r
   Copy data from MMIO region to system memory by using 32-bit access.\r
 \r
-  Copy data from MMIO region specified by starting address StartAddress \r
-  to system memory specified by Buffer by using 32-bit access. The total \r
+  Copy data from MMIO region specified by starting address StartAddress\r
+  to system memory specified by Buffer by using 32-bit access. The total\r
   number of byte to be copied is specified by Length. Buffer is returned.\r
-  \r
+\r
   If StartAddress is not aligned on a 32-bit boundary, then ASSERT().\r
 \r
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   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  StartAddress    The starting address for the MMIO region to be copied from.\r
   @param  Length          The size, in bytes, of Buffer.\r
-  @param  Buffer          Pointer to a system memory buffer receiving the data read.\r
+  @param  Buffer          The pointer to a system memory buffer receiving the data read.\r
 \r
   @return Buffer\r
 \r
@@ -145,15 +139,15 @@ MmioReadBuffer32 (
   UINT32    *ReturnBuffer;\r
 \r
   ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);\r
-  \r
+\r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\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
\r
+\r
   ReturnBuffer = Buffer;\r
-  \r
+\r
   while (Length != 0) {\r
     *(Buffer++) = MmioRead32 (StartAddress);\r
     StartAddress += sizeof (UINT32);\r
@@ -166,21 +160,21 @@ MmioReadBuffer32 (
 /**\r
   Copy data from MMIO region to system memory by using 64-bit access.\r
 \r
-  Copy data from MMIO region specified by starting address StartAddress \r
-  to system memory specified by Buffer by using 64-bit access. The total \r
+  Copy data from MMIO region specified by starting address StartAddress\r
+  to system memory specified by Buffer by using 64-bit access. The total\r
   number of byte to be copied is specified by Length. Buffer is returned.\r
-  \r
+\r
   If StartAddress is not aligned on a 64-bit boundary, then ASSERT().\r
 \r
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
   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
   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  StartAddress    The starting address for the MMIO region to be copied from.\r
   @param  Length          The size, in bytes, of Buffer.\r
-  @param  Buffer          Pointer to a system memory buffer receiving the data read.\r
+  @param  Buffer          The pointer to a system memory buffer receiving the data read.\r
 \r
   @return Buffer\r
 \r
@@ -196,15 +190,15 @@ MmioReadBuffer64 (
   UINT64    *ReturnBuffer;\r
 \r
   ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);\r
-  \r
+\r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\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
\r
+\r
   ReturnBuffer = Buffer;\r
-  \r
+\r
   while (Length != 0) {\r
     *(Buffer++) = MmioRead64 (StartAddress);\r
     StartAddress += sizeof (UINT64);\r
@@ -218,17 +212,17 @@ MmioReadBuffer64 (
 /**\r
   Copy data from system memory to MMIO region by using 8-bit access.\r
 \r
-  Copy data from system memory specified by Buffer to MMIO region specified \r
-  by starting address StartAddress by using 8-bit access. The total number \r
+  Copy data from system memory specified by Buffer to MMIO region specified\r
+  by starting address StartAddress by using 8-bit access. The total number\r
   of byte to be copied is specified by Length. Buffer is returned.\r
-  \r
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+\r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
   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  StartAddress    The starting address for the MMIO region to be copied to.\r
   @param  Length          The size, in bytes, of Buffer.\r
-  @param  Buffer          Pointer to a system memory buffer containing the data to write.\r
+  @param  Buffer          The pointer to a system memory buffer containing the data to write.\r
 \r
   @return Buffer\r
 \r
@@ -245,36 +239,36 @@ MmioWriteBuffer8 (
 \r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN) Buffer));\r
\r
+\r
   ReturnBuffer = (UINT8 *) Buffer;\r
-  \r
+\r
   while (Length-- != 0) {\r
      MmioWrite8 (StartAddress++, *(Buffer++));\r
   }\r
 \r
   return ReturnBuffer;\r
\r
+\r
 }\r
 \r
 /**\r
   Copy data from system memory to MMIO region by using 16-bit access.\r
 \r
-  Copy data from system memory specified by Buffer to MMIO region specified \r
-  by starting address StartAddress by using 16-bit access. The total number \r
+  Copy data from system memory specified by Buffer to MMIO region specified\r
+  by starting address StartAddress by using 16-bit access. The total number\r
   of byte to be copied is specified by Length. Buffer is returned.\r
-  \r
+\r
   If StartAddress is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
   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
   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  StartAddress    The starting address for the MMIO region to be copied to.\r
   @param  Length          The size, in bytes, of Buffer.\r
-  @param  Buffer          Pointer to a system memory buffer containing the data to write.\r
+  @param  Buffer          The pointer to a system memory buffer containing the data to write.\r
 \r
   @return Buffer\r
 \r
@@ -290,7 +284,7 @@ MmioWriteBuffer16 (
   UINT16    *ReturnBuffer;\r
 \r
   ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);\r
-  \r
+\r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN) Buffer));\r
 \r
@@ -298,10 +292,10 @@ MmioWriteBuffer16 (
   ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);\r
 \r
   ReturnBuffer = (UINT16 *) Buffer;\r
-  \r
+\r
   while (Length != 0) {\r
     MmioWrite16 (StartAddress, *(Buffer++));\r
-    \r
+\r
     StartAddress += sizeof (UINT16);\r
     Length -= sizeof (UINT16);\r
   }\r
@@ -313,22 +307,22 @@ MmioWriteBuffer16 (
 /**\r
   Copy data from system memory to MMIO region by using 32-bit access.\r
 \r
-  Copy data from system memory specified by Buffer to MMIO region specified \r
-  by starting address StartAddress by using 32-bit access. The total number \r
+  Copy data from system memory specified by Buffer to MMIO region specified\r
+  by starting address StartAddress by using 32-bit access. The total number\r
   of byte to be copied is specified by Length. Buffer is returned.\r
-  \r
+\r
   If StartAddress is not aligned on a 32-bit boundary, then ASSERT().\r
 \r
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
   If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r
 \r
   If Length is not aligned on a 32-bit boundary, then ASSERT().\r
 \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  StartAddress    The starting address for the MMIO region to be copied to.\r
   @param  Length          The size, in bytes, of Buffer.\r
-  @param  Buffer          Pointer to a system memory buffer containing the data to write.\r
+  @param  Buffer          The pointer to a system memory buffer containing the data to write.\r
 \r
   @return Buffer\r
 \r
@@ -344,7 +338,7 @@ MmioWriteBuffer32 (
   UINT32    *ReturnBuffer;\r
 \r
   ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);\r
-  \r
+\r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN) Buffer));\r
 \r
@@ -352,10 +346,10 @@ MmioWriteBuffer32 (
   ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);\r
 \r
   ReturnBuffer = (UINT32 *) Buffer;\r
-  \r
+\r
   while (Length != 0) {\r
     MmioWrite32 (StartAddress, *(Buffer++));\r
-    \r
+\r
     StartAddress += sizeof (UINT32);\r
     Length -= sizeof (UINT32);\r
   }\r
@@ -366,22 +360,22 @@ MmioWriteBuffer32 (
 /**\r
   Copy data from system memory to MMIO region by using 64-bit access.\r
 \r
-  Copy data from system memory specified by Buffer to MMIO region specified \r
-  by starting address StartAddress by using 64-bit access. The total number \r
+  Copy data from system memory specified by Buffer to MMIO region specified\r
+  by starting address StartAddress by using 64-bit access. The total number\r
   of byte to be copied is specified by Length. Buffer is returned.\r
-  \r
+\r
   If StartAddress is not aligned on a 64-bit boundary, then ASSERT().\r
 \r
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
   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
   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  StartAddress    The starting address for the MMIO region to be copied to.\r
   @param  Length          The size, in bytes, of Buffer.\r
-  @param  Buffer          Pointer to a system memory buffer containing the data to write.\r
+  @param  Buffer          The pointer to a system memory buffer containing the data to write.\r
 \r
   @return Buffer\r
 \r
@@ -397,7 +391,7 @@ MmioWriteBuffer64 (
   UINT64    *ReturnBuffer;\r
 \r
   ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);\r
-  \r
+\r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - StartAddress));\r
   ASSERT ((Length - 1) <=  (MAX_ADDRESS - (UINTN) Buffer));\r
 \r
@@ -405,10 +399,10 @@ MmioWriteBuffer64 (
   ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);\r
 \r
   ReturnBuffer = (UINT64 *) Buffer;\r
-  \r
+\r
   while (Length != 0) {\r
     MmioWrite64 (StartAddress, *(Buffer++));\r
-    \r
+\r
     StartAddress += sizeof (UINT64);\r
     Length -= sizeof (UINT64);\r
   }\r