]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Include/Library/DmaLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / EmbeddedPkg / Include / Library / DmaLib.h
index 3814291c2875a26e34db78f6c8a1b168d56a112c..44bc71a1f6e7c3340c83d0392bd2c7e18b003437 100644 (file)
 \r
   Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
 \r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  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
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -57,9 +51,6 @@ typedef enum {
   MapOperationMaximum\r
 } DMA_MAP_OPERATION;\r
 \r
-\r
-\r
-\r
 /**\r
   Provides the DMA controller-specific addresses needed to access system memory.\r
 \r
@@ -83,16 +74,13 @@ typedef enum {
 EFI_STATUS\r
 EFIAPI\r
 DmaMap (\r
-  IN     DMA_MAP_OPERATION              Operation,\r
-  IN     VOID                           *HostAddress,\r
-  IN OUT UINTN                          *NumberOfBytes,\r
-  OUT    PHYSICAL_ADDRESS               *DeviceAddress,\r
-  OUT    VOID                           **Mapping\r
+  IN     DMA_MAP_OPERATION  Operation,\r
+  IN     VOID               *HostAddress,\r
+  IN OUT UINTN              *NumberOfBytes,\r
+  OUT    PHYSICAL_ADDRESS   *DeviceAddress,\r
+  OUT    VOID               **Mapping\r
   );\r
 \r
-\r
-\r
-\r
 /**\r
   Completes the DmaMapBusMasterRead, DmaMapBusMasterWrite, or DmaMapBusMasterCommonBuffer\r
   operation and releases any corresponding resources.\r
@@ -106,10 +94,9 @@ DmaMap (
 EFI_STATUS\r
 EFIAPI\r
 DmaUnmap (\r
-  IN  VOID                         *Mapping\r
+  IN  VOID  *Mapping\r
   );\r
 \r
-\r
 /**\r
   Allocates pages that are suitable for an DmaMap() of type MapOperationBusMasterCommonBuffer.\r
   mapping.\r
@@ -130,12 +117,11 @@ DmaUnmap (
 EFI_STATUS\r
 EFIAPI\r
 DmaAllocateBuffer (\r
-  IN  EFI_MEMORY_TYPE              MemoryType,\r
-  IN  UINTN                        Pages,\r
-  OUT VOID                         **HostAddress\r
+  IN  EFI_MEMORY_TYPE  MemoryType,\r
+  IN  UINTN            Pages,\r
+  OUT VOID             **HostAddress\r
   );\r
 \r
-\r
 /**\r
   Frees memory that was allocated with DmaAllocateBuffer().\r
 \r
@@ -150,10 +136,36 @@ DmaAllocateBuffer (
 EFI_STATUS\r
 EFIAPI\r
 DmaFreeBuffer (\r
-  IN  UINTN                        Pages,\r
-  IN  VOID                         *HostAddress\r
+  IN  UINTN  Pages,\r
+  IN  VOID   *HostAddress\r
   );\r
 \r
+/**\r
+  Allocates pages that are suitable for an DmaMap() of type\r
+  MapOperationBusMasterCommonBuffer mapping, at the requested alignment.\r
 \r
-#endif\r
+  @param  MemoryType            The type of memory to allocate, EfiBootServicesData or\r
+                                EfiRuntimeServicesData.\r
+  @param  Pages                 The number of pages to allocate.\r
+  @param  Alignment             Alignment in bytes of the base of the returned\r
+                                buffer (must be a power of 2)\r
+  @param  HostAddress           A pointer to store the base system memory address of the\r
+                                allocated range.\r
+\r
+  @retval EFI_SUCCESS           The requested memory pages were allocated.\r
+  @retval EFI_UNSUPPORTED       Attributes is unsupported. The only legal attribute bits are\r
+                                MEMORY_WRITE_COMBINE and MEMORY_CACHED.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The memory pages could not be allocated.\r
 \r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DmaAllocateAlignedBuffer (\r
+  IN  EFI_MEMORY_TYPE  MemoryType,\r
+  IN  UINTN            Pages,\r
+  IN  UINTN            Alignment,\r
+  OUT VOID             **HostAddress\r
+  );\r
+\r
+#endif\r