TianoCore EDK2 master
Loading...
Searching...
No Matches
IoMmuInternal.h
Go to the documentation of this file.
1
9#ifndef IOMMU_INTERNAL_H_
10#define IOMMU_INTERNAL_H_
11
12#include <Base.h>
13#include <Protocol/IoMmu.h>
14#include <Uefi/UefiBaseType.h>
15#include <Uefi/UefiSpec.h>
16
17#define MAP_INFO_SIG SIGNATURE_64 ('M', 'A', 'P', '_', 'I', 'N', 'F', 'O')
18
19typedef struct {
20 UINT64 Signature;
21 LIST_ENTRY Link;
22 EDKII_IOMMU_OPERATION Operation;
23 UINTN NumberOfBytes;
24 UINTN NumberOfPages;
25 EFI_PHYSICAL_ADDRESS CryptedAddress;
26 EFI_PHYSICAL_ADDRESS PlainTextAddress;
27 UINT32 ReservedMemBitmap;
28} MAP_INFO;
29
30#define COMMON_BUFFER_SIG SIGNATURE_64 ('C', 'M', 'N', 'B', 'U', 'F', 'F', 'R')
31
32#pragma pack (1)
33//
34// The following structure enables Map() and Unmap() to perform in-place
35// decryption and encryption, respectively, for BusMasterCommonBuffer[64]
36// operations, without dynamic memory allocation or release.
37//
38// Both COMMON_BUFFER_HEADER and COMMON_BUFFER_HEADER.StashBuffer are allocated
39// by AllocateBuffer() and released by FreeBuffer().
40//
41typedef struct {
42 UINT64 Signature;
43
44 //
45 // Always allocated from EfiBootServicesData type memory, and always
46 // encrypted.
47 //
48 VOID *StashBuffer;
49
50 //
51 // Bitmap of reserved memory
52 //
53 UINT32 ReservedMemBitmap;
54
55 //
56 // Followed by the actual common buffer, starting at the next page.
57 //
59
60//
61// This data structure defines a memory range in the reserved memory region.
62// Please refer to IoMmuInitReservedSharedMem() for detailed information.
63//
64// The memory region looks like:
65// |------------|----------------------------|
66// | Header | Data |
67// | 4k, private| 4k/32k/128k/etc, shared |
68// |-----------------------------------------|
69//
70typedef struct {
71 UINT32 BitmapMask;
72 UINT32 Shift;
73 UINT32 Slots;
74 UINT32 DataSize;
75 UINT32 HeaderSize;
76 EFI_PHYSICAL_ADDRESS StartAddressOfMemRange;
78#pragma pack()
79
104 VOID
105 );
106
114 BOOLEAN MemoryMapLocked
115 );
116
130 IN EFI_MEMORY_TYPE MemoryType,
131 IN OUT MAP_INFO *MapInfo
132 );
133
142 IN OUT MAP_INFO *MapInfo
143 );
144
158 IN EFI_MEMORY_TYPE MemoryType,
159 IN UINTN CommonBufferPages,
160 OUT EFI_PHYSICAL_ADDRESS *PhysicalAddress,
161 OUT UINT32 *ReservedMemBitmap
162 );
163
175 IN COMMON_BUFFER_HEADER *CommonBufferHeader,
176 IN UINTN CommonBufferPages
177 );
178
179#endif
UINT64 UINTN
EFI_STATUS IoMmuAllocateCommonBuffer(IN EFI_MEMORY_TYPE MemoryType, IN UINTN CommonBufferPages, OUT EFI_PHYSICAL_ADDRESS *PhysicalAddress, OUT UINT32 *ReservedMemBitmap)
Definition: IoMmuBuffer.c:457
EFI_STATUS IoMmuFreeBounceBuffer(IN OUT MAP_INFO *MapInfo)
Definition: IoMmuBuffer.c:421
EFI_STATUS IoMmuFreeCommonBuffer(IN COMMON_BUFFER_HEADER *CommonBufferHeader, IN UINTN CommonBufferPages)
Definition: IoMmuBuffer.c:492
EFI_STATUS IoMmuInitReservedSharedMem(VOID)
Definition: IoMmuBuffer.c:136
EFI_STATUS IoMmuReleaseReservedSharedMem(BOOLEAN MemoryMapLocked)
Definition: IoMmuBuffer.c:203
EFI_STATUS IoMmuAllocateBounceBuffer(IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN OUT MAP_INFO *MapInfo)
Definition: IoMmuBuffer.c:372
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EDKII_IOMMU_OPERATION
Definition: IoMmu.h:44
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
EFI_MEMORY_TYPE
EFI_ALLOCATE_TYPE
Definition: UefiSpec.h:29