TianoCore EDK2 master
|
#include <Base.h>
#include <Protocol/IoMmu.h>
#include <Uefi/UefiBaseType.h>
#include <Uefi/UefiSpec.h>
Go to the source code of this file.
Data Structures | |
struct | MAP_INFO |
struct | COMMON_BUFFER_HEADER |
struct | IOMMU_RESERVED_MEM_RANGE |
Macros | |
#define | MAP_INFO_SIG SIGNATURE_64 ('M', 'A', 'P', '_', 'I', 'N', 'F', 'O') |
#define | COMMON_BUFFER_SIG SIGNATURE_64 ('C', 'M', 'N', 'B', 'U', 'F', 'F', 'R') |
Functions | |
EFI_STATUS | IoMmuInitReservedSharedMem (VOID) |
EFI_STATUS | IoMmuReleaseReservedSharedMem (BOOLEAN MemoryMapLocked) |
EFI_STATUS | IoMmuAllocateBounceBuffer (IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN OUT MAP_INFO *MapInfo) |
EFI_STATUS | IoMmuFreeBounceBuffer (IN OUT MAP_INFO *MapInfo) |
EFI_STATUS | IoMmuAllocateCommonBuffer (IN EFI_MEMORY_TYPE MemoryType, IN UINTN CommonBufferPages, OUT EFI_PHYSICAL_ADDRESS *PhysicalAddress, OUT UINT32 *ReservedMemBitmap) |
EFI_STATUS | IoMmuFreeCommonBuffer (IN COMMON_BUFFER_HEADER *CommonBufferHeader, IN UINTN CommonBufferPages) |
Copyright (c) 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file IoMmuInternal.h.
#define COMMON_BUFFER_SIG SIGNATURE_64 ('C', 'M', 'N', 'B', 'U', 'F', 'F', 'R') |
Definition at line 30 of file IoMmuInternal.h.
#define MAP_INFO_SIG SIGNATURE_64 ('M', 'A', 'P', '_', 'I', 'N', 'F', 'O') |
Definition at line 17 of file IoMmuInternal.h.
EFI_STATUS IoMmuAllocateBounceBuffer | ( | IN EFI_ALLOCATE_TYPE | Type, |
IN EFI_MEMORY_TYPE | MemoryType, | ||
IN OUT MAP_INFO * | MapInfo | ||
) |
Allocate reserved shared memory for bounce buffer.
Type | Allocate type |
MemoryType | The memory type to be allocated |
MapInfo | Pointer to the MAP_INFO |
EFI_SUCCESS | Successfully allocate the bounce buffer |
Other | As the error code indicates |
Definition at line 372 of file IoMmuBuffer.c.
EFI_STATUS IoMmuAllocateCommonBuffer | ( | IN EFI_MEMORY_TYPE | MemoryType, |
IN UINTN | CommonBufferPages, | ||
OUT EFI_PHYSICAL_ADDRESS * | PhysicalAddress, | ||
OUT UINT32 * | ReservedMemBitmap | ||
) |
Allocate CommonBuffer from pre-allocated shared memory.
MemoryType | Memory type |
CommonBufferPages | Pages of CommonBuffer |
PhysicalAddress | Allocated physical address |
ReservedMemBitmap | Bitmap which indicates the allocation of reserved memory |
EFI_SUCCESS | Successfully allocate the common buffer |
Other | As the error code indicates |
Definition at line 457 of file IoMmuBuffer.c.
EFI_STATUS IoMmuFreeBounceBuffer | ( | IN OUT MAP_INFO * | MapInfo | ) |
Free the bounce buffer allocated in IoMmuAllocateBounceBuffer.
MapInfo | Pointer to the MAP_INFO |
Definition at line 421 of file IoMmuBuffer.c.
EFI_STATUS IoMmuFreeCommonBuffer | ( | IN COMMON_BUFFER_HEADER * | CommonBufferHeader, |
IN UINTN | CommonBufferPages | ||
) |
Free CommonBuffer which is allocated by IoMmuAllocateCommonBuffer().
CommonBufferHeader | Pointer to the CommonBufferHeader |
CommonBufferPages | Pages of CommonBuffer |
EFI_SUCCESS | Successfully free the common buffer |
Other | As the error code indicates |
Definition at line 492 of file IoMmuBuffer.c.
EFI_STATUS IoMmuInitReservedSharedMem | ( | VOID | ) |
Allocate a memory region and convert it to be shared. This memory region will be used in the DMA operation.
The pre-alloc memory contains pieces of memory regions with different size. The allocation of the shared memory regions are indicated by a 32-bit bitmap (mReservedMemBitmap).
The memory regions are consumed by IoMmuAllocateBuffer (in which CommonBuffer is allocated) and IoMmuMap (in which bounce buffer is allocated).
The CommonBuffer contains 2 parts, one page for CommonBufferHeader which is private memory, the other part is shared memory. So the layout of a piece of memory region after initialization looks like:
|------------|----------------------------| | Header | Data | <-- a piece of pre-alloc memory region | 4k, private| 4k/32k/128k/etc, shared | |-----------------------------------------|
EFI_SUCCESS | Successfully initialize the reserved memory. |
EFI_UNSUPPORTED | This feature is not supported. |
Definition at line 136 of file IoMmuBuffer.c.
EFI_STATUS IoMmuReleaseReservedSharedMem | ( | BOOLEAN | MemoryMapLocked | ) |
Release the pre-alloc shared memory.
EFI_SUCCESS | Successfully release the shared memory |
Definition at line 203 of file IoMmuBuffer.c.