X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=EmbeddedPkg%2FLibrary%2FCoherentDmaLib%2FCoherentDmaLib.c;h=74665436649fc46288ebd259c7aa2679db05bb43;hb=e7108d0e9655b1795c94ac372b0449f28dd907df;hp=eb88fa288a99b649f004dc9d95c09ef67a83c4fd;hpb=c4709260f62f531eed83673104c7ecd7b6e665b7;p=mirror_edk2.git
diff --git a/EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.c b/EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.c
index eb88fa288a..7466543664 100644
--- a/EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.c
+++ b/EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.c
@@ -3,13 +3,7 @@
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -18,11 +12,10 @@
#include
#include
-
STATIC
PHYSICAL_ADDRESS
HostToDeviceAddress (
- IN VOID *Address
+ IN VOID *Address
)
{
return (PHYSICAL_ADDRESS)(UINTN)Address + PcdGet64 (PcdDmaDeviceOffset);
@@ -51,25 +44,26 @@ HostToDeviceAddress (
EFI_STATUS
EFIAPI
DmaMap (
- IN DMA_MAP_OPERATION Operation,
- IN VOID *HostAddress,
- IN OUT UINTN *NumberOfBytes,
- OUT PHYSICAL_ADDRESS *DeviceAddress,
- OUT VOID **Mapping
+ IN DMA_MAP_OPERATION Operation,
+ IN VOID *HostAddress,
+ IN OUT UINTN *NumberOfBytes,
+ OUT PHYSICAL_ADDRESS *DeviceAddress,
+ OUT VOID **Mapping
)
{
- if (HostAddress == NULL ||
- NumberOfBytes == NULL ||
- DeviceAddress == NULL ||
- Mapping == NULL ) {
+ if ((HostAddress == NULL) ||
+ (NumberOfBytes == NULL) ||
+ (DeviceAddress == NULL) ||
+ (Mapping == NULL))
+ {
return EFI_INVALID_PARAMETER;
}
+
*DeviceAddress = HostToDeviceAddress (HostAddress);
- *Mapping = NULL;
+ *Mapping = NULL;
return EFI_SUCCESS;
}
-
/**
Completes the DmaMapBusMasterRead(), DmaMapBusMasterWrite(), or DmaMapBusMasterCommonBuffer()
operation and releases any corresponding resources.
@@ -83,7 +77,7 @@ DmaMap (
EFI_STATUS
EFIAPI
DmaUnmap (
- IN VOID *Mapping
+ IN VOID *Mapping
)
{
return EFI_SUCCESS;
@@ -109,15 +103,14 @@ DmaUnmap (
EFI_STATUS
EFIAPI
DmaAllocateBuffer (
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- OUT VOID **HostAddress
+ IN EFI_MEMORY_TYPE MemoryType,
+ IN UINTN Pages,
+ OUT VOID **HostAddress
)
{
return DmaAllocateAlignedBuffer (MemoryType, Pages, 0, HostAddress);
}
-
/**
Allocates pages that are suitable for an DmaMap() of type
MapOperationBusMasterCommonBuffer mapping, at the requested alignment.
@@ -140,18 +133,19 @@ DmaAllocateBuffer (
EFI_STATUS
EFIAPI
DmaAllocateAlignedBuffer (
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- IN UINTN Alignment,
- OUT VOID **HostAddress
+ IN EFI_MEMORY_TYPE MemoryType,
+ IN UINTN Pages,
+ IN UINTN Alignment,
+ OUT VOID **HostAddress
)
{
if (Alignment == 0) {
Alignment = EFI_PAGE_SIZE;
}
- if (HostAddress == NULL ||
- (Alignment & (Alignment - 1)) != 0) {
+ if ((HostAddress == NULL) ||
+ ((Alignment & (Alignment - 1)) != 0))
+ {
return EFI_INVALID_PARAMETER;
}
@@ -169,10 +163,10 @@ DmaAllocateAlignedBuffer (
if (*HostAddress == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
return EFI_SUCCESS;
}
-
/**
Frees memory that was allocated with DmaAllocateBuffer().
@@ -187,15 +181,14 @@ DmaAllocateAlignedBuffer (
EFI_STATUS
EFIAPI
DmaFreeBuffer (
- IN UINTN Pages,
- IN VOID *HostAddress
+ IN UINTN Pages,
+ IN VOID *HostAddress
)
{
if (HostAddress == NULL) {
- return EFI_INVALID_PARAMETER;
+ return EFI_INVALID_PARAMETER;
}
FreePages (HostAddress, Pages);
return EFI_SUCCESS;
}
-